@open-press/cli 0.3.0 → 0.5.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.
Files changed (94) hide show
  1. package/dist/cli.js +20 -37
  2. package/package.json +1 -1
  3. package/template/core/CHANGELOG.md +43 -0
  4. package/template/core/engine/cli.mjs +6 -0
  5. package/template/core/engine/commands/_shared.mjs +9 -2
  6. package/template/core/engine/commands/deploy.mjs +3 -3
  7. package/template/core/engine/commands/dev.mjs +25 -2
  8. package/template/core/engine/commands/doctor.mjs +229 -0
  9. package/template/core/engine/commands/pdf.mjs +3 -3
  10. package/template/core/engine/commands/preview.mjs +4 -4
  11. package/template/core/engine/commands/upgrade.mjs +117 -0
  12. package/template/core/package.json +3 -1
  13. package/template/core/vite.config.ts +26 -11
  14. package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/chapters/03-agent-skills-contributors/content/01-agent-skills-contributors.mdx +2 -3
  15. package/template/core/.turbo/turbo-test.log +0 -341
  16. package/template/skills/chinese-ai-writing-polish/SKILL.md +0 -195
  17. package/template/skills/claude-document/SKILL.md +0 -66
  18. package/template/skills/editorial-monograph/SKILL.md +0 -73
  19. package/template/skills/openpress/SKILL.md +0 -114
  20. package/template/skills/openpress/references/cli-commands.md +0 -31
  21. package/template/skills/openpress/references/local-review.md +0 -43
  22. package/template/skills/openpress-deploy/SKILL.md +0 -69
  23. package/template/skills/openpress-deploy/references/cloudflare-pages.md +0 -51
  24. package/template/skills/openpress-design/SKILL.md +0 -51
  25. package/template/skills/openpress-design/references/pdf-safe-css.md +0 -29
  26. package/template/skills/openpress-design/references/responsive-fixed-layout.md +0 -48
  27. package/template/skills/openpress-design/references/theme-and-components.md +0 -77
  28. package/template/skills/openpress-diagram-drawing/SKILL.md +0 -44
  29. package/template/skills/openpress-diagram-drawing/references/diagram-patterns.md +0 -93
  30. package/template/skills/openpress-document-hierarchy/SKILL.md +0 -81
  31. package/template/skills/openpress-document-hierarchy/agents/openai.yaml +0 -4
  32. package/template/skills/openpress-document-hierarchy/references/data-structures-outline.md +0 -115
  33. package/template/skills/openpress-init/SKILL.md +0 -84
  34. package/template/skills/openpress-style-pack-contributor/SKILL.md +0 -62
  35. package/template/skills/openpress-style-pack-contributor/references/starter-contract.md +0 -49
  36. package/template/skills/openpress-update/SKILL.md +0 -88
  37. package/template/skills/openpress-writing/SKILL.md +0 -68
  38. package/template/skills/openpress-writing/references/source-and-writing-rules.md +0 -120
  39. package/template/skills/teaching-notes-writing/SKILL.md +0 -54
  40. package/template/skills/teaching-notes-writing/references/programming.md +0 -65
  41. package/template/skills/teaching-notes-writing/references/teaching-patterns.md +0 -60
  42. /package/template/{skills/claude-document/starter → packs/claude-document}/document/chapters/01-document-shape/chapter.tsx +0 -0
  43. /package/template/{skills/claude-document/starter → packs/claude-document}/document/chapters/01-document-shape/content/01-document-shape.mdx +0 -0
  44. /package/template/{skills/claude-document/starter → packs/claude-document}/document/chapters/02-review-loop/chapter.tsx +0 -0
  45. /package/template/{skills/claude-document/starter → packs/claude-document}/document/chapters/02-review-loop/content/01-review-loop.mdx +0 -0
  46. /package/template/{skills/claude-document/starter → packs/claude-document}/document/components/ChapterOpenerVisual.tsx +0 -0
  47. /package/template/{skills/claude-document/starter → packs/claude-document}/document/components/Page.tsx +0 -0
  48. /package/template/{skills/claude-document/starter → packs/claude-document}/document/design.md +0 -0
  49. /package/template/{skills/claude-document/starter → packs/claude-document}/document/index.tsx +0 -0
  50. /package/template/{skills/claude-document/starter → packs/claude-document}/document/media/README.md +0 -0
  51. /package/template/{skills/claude-document/starter → packs/claude-document}/document/openpress.config.mjs +0 -0
  52. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/README.md +0 -0
  53. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/base/page-contract.css +0 -0
  54. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/base/print.css +0 -0
  55. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/base/typography.css +0 -0
  56. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/fonts.css +0 -0
  57. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/page-surfaces/back-cover.css +0 -0
  58. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/page-surfaces/chapter-opener.css +0 -0
  59. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/page-surfaces/cover.css +0 -0
  60. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/page-surfaces/toc.css +0 -0
  61. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/patterns/_chart-frame.css +0 -0
  62. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/patterns/figure-grid.css +0 -0
  63. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/patterns/table-utilities.css +0 -0
  64. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/shell/reader-controls.css +0 -0
  65. /package/template/{skills/claude-document/starter → packs/claude-document}/document/theme/tokens.css +0 -0
  66. /package/template/{skills/claude-document/starter → packs/claude-document}/openpress.config.mjs +0 -0
  67. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/chapters/01-product-and-use-cases/content/01-product-and-use-cases.mdx +0 -0
  68. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/chapters/02-workflow/content/01-workflow.mdx +0 -0
  69. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/chapters/04-validation-deploy/content/01-validation-deploy.mdx +0 -0
  70. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/ChapterOpenerVisual/index.tsx +0 -0
  71. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/Page.tsx +0 -0
  72. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/TokenSwatchGrid/index.tsx +0 -0
  73. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/TokenSwatchGrid/style.css +0 -0
  74. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/TypeSpecimen/index.tsx +0 -0
  75. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/components/TypeSpecimen/style.css +0 -0
  76. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/design.md +0 -0
  77. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/index.tsx +0 -0
  78. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/media/README.md +0 -0
  79. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/openpress.config.mjs +0 -0
  80. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/README.md +0 -0
  81. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/base/page-contract.css +0 -0
  82. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/base/print.css +0 -0
  83. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/base/typography.css +0 -0
  84. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/fonts.css +0 -0
  85. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/page-surfaces/back-cover.css +0 -0
  86. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/page-surfaces/chapter-opener.css +0 -0
  87. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/page-surfaces/cover.css +0 -0
  88. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/page-surfaces/toc.css +0 -0
  89. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/patterns/_chart-frame.css +0 -0
  90. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/patterns/figure-grid.css +0 -0
  91. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/patterns/table-utilities.css +0 -0
  92. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/shell/reader-controls.css +0 -0
  93. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/document/theme/tokens.css +0 -0
  94. /package/template/{skills/editorial-monograph/starter → packs/editorial-monograph}/openpress.config.mjs +0 -0
@@ -1,51 +0,0 @@
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.
@@ -1,29 +0,0 @@
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.
@@ -1,48 +0,0 @@
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.
@@ -1,77 +0,0 @@
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.
@@ -1,44 +0,0 @@
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.
@@ -1,93 +0,0 @@
1
- # Diagram Patterns
2
-
3
- ## Figure Text
4
-
5
- Keep text inside a figure only when it anchors something spatial:
6
-
7
- | Keep Inside | Move To Prose |
8
- | --- | --- |
9
- | `Before`, `After`, `插入前`, `插入後` | reasons a step matters |
10
- | `first`, `top`, `prev`, `curr`, `next`, `NULL` | warnings and edge cases |
11
- | field names, axis labels, legends | figure numbering or caption prose |
12
- | short role labels | answers or hidden hints |
13
-
14
- ## Vocabulary
15
-
16
- | Item | Draw As |
17
- | --- | --- |
18
- | data node | box split into fields |
19
- | singly linked node | `data | next`, arrow leaves `next` |
20
- | doubly linked node | `prev | data | next`, forward and backward lanes separated |
21
- | header/dummy node | normal node with `head` or `dummy` role |
22
- | external pointer | label with arrow to a node |
23
- | field link | arrow from field to target node |
24
- | traversal | pointer labels moving between states |
25
- | `NULL` | terminal label or terminator mark |
26
-
27
- ## Linked List Patterns
28
-
29
- Basic list:
30
-
31
- - Draw each node as `data | next`.
32
- - Last `next` points to `NULL`.
33
- - Use `first`, `data`, `next`, and `NULL` as figure labels.
34
-
35
- Insert after:
36
-
37
- - Use two aligned states: `p -> q` and `p -> x -> q`.
38
- - If showing update order, number only changed links:
39
- 1. `x->next = q`
40
- 2. `p->next = x`
41
-
42
- Delete after:
43
-
44
- - Use two aligned states: `p -> q -> r` and `p -> r`.
45
- - If the removed node remains visible, ghost it or mark it removed.
46
-
47
- Reverse:
48
-
49
- - Show `prev`, `curr`, and `next` as pointer labels, not data nodes.
50
- - Use a short sequence or table for repeated iterations.
51
-
52
- ## Circular And Doubly Linked Lists
53
-
54
- Circular return links should look intentional:
55
-
56
- - route return links outside the node group;
57
- - avoid diagonal clutter over labels;
58
- - for one-node circular lists, draw a small self-loop.
59
-
60
- When using `last` as the entry pointer, show both `last` and `last->next`.
61
-
62
- Doubly linked lists:
63
-
64
- - separate forward and backward lanes;
65
- - insertion between `x` and `y` shows four relationships:
66
- - `p->prev = x`
67
- - `p->next = y`
68
- - `x->next = p`
69
- - `y->prev = p`
70
-
71
- ## Stack, Queue, Polynomial, Sparse, Tree
72
-
73
- Linked stack:
74
-
75
- - `top` points to the first node.
76
- - push is insert-at-front; pop is remove-at-front.
77
-
78
- Linked queue:
79
-
80
- - `front` points to the next node to delete.
81
- - `rear` points to the last node.
82
- - show both when the invariant depends on both.
83
-
84
- Polynomial and sparse structures:
85
-
86
- - use tables for dense coefficient arrays or matrix positions;
87
- - use diagrams only for stored nonzero nodes.
88
-
89
- Trees:
90
-
91
- - label parent/child relationships clearly;
92
- - use traversal diagrams only when node order or pointer movement is the point;
93
- - avoid turning a tree diagram into a paragraph.
@@ -1,81 +0,0 @@
1
- ---
2
- name: openpress-document-hierarchy
3
- description: Use when planning, restructuring, or extending a open-press long-form document, handout, textbook, study guide, reference manual, or course note that needs a stable H1/H2/H3/H4 semantic hierarchy, table of contents depth, reader outline depth, chapter grouping, appendix placement, or multi-unit document structure.
4
- ---
5
-
6
- # open-press Document Hierarchy
7
-
8
- This skill owns the **document skeleton**: visible heading levels, formal TOC depth, reader outline depth, chapter grouping, and appendix placement. It does not own prose, visual style, figure design, or component implementation.
9
-
10
- ## When To Enter This Skill
11
-
12
- `openpress-writing` is the default entry point for content work. Route here when the work involves any of:
13
-
14
- - Adding or removing an H2 chapter, or splitting one chapter into two.
15
- - Promoting / demoting headings across H2 / H3 / H4.
16
- - Changing TOC depth or reader outline depth.
17
- - Reorganizing appendices, or deciding what becomes an appendix vs an inline section.
18
- - Auditing H4 granularity (too many vs too few sub-sections).
19
-
20
- Hand back to `openpress-writing` once the structure is settled — prose, captions, exercises, and explanation order are not this skill's job.
21
-
22
- Use `openpress` for CLI inspection, source search, and validation. This skill decides the heading model; it does not decide the command surface.
23
-
24
- ## Hierarchy Contract
25
-
26
- Map document content to headings by semantic role:
27
-
28
- | Level | Meaning | open-press behavior |
29
- | --- | --- | --- |
30
- | `#` | Whole document title only | Use on cover or document identity; do not use inside normal content files |
31
- | `##` | Formal chapter / document unit | Enters the formal TOC; starts a major reader section |
32
- | `###` | Major topic group inside a chapter | Enters the formal TOC; use for concepts readers should scan before reading |
33
- | `####` | Concrete algorithm, operation, theorem, variant, or worked procedure | Enters reader outline/bookmarks; normally stays out of the formal TOC |
34
- | Body blocks | Concept, table, figure, pseudocode, code, trace, practice | Do the explanation work; do not encode hierarchy by font size alone |
35
-
36
- When a document becomes a full book or multi-unit reference, avoid promoting every algorithm to `##`. A stable long-form document usually has few H2 chapters, several H3 topic groups, and many H4 implementation items.
37
-
38
- ## H4 Granularity
39
-
40
- Use H4 for a complete teachable unit, not for every local teaching block.
41
-
42
- - Keep one H4 when the blocks share the same operation, invariant, or algorithm.
43
- - Merge adjacent H4s when one only adds the table, figure, trace, pseudocode, or C-like code for the same topic.
44
- - Do not make repeated local `小測驗` headings into H4; use a bold paragraph or exercise block unless the whole section is an assessment chapter.
45
- - Prefer 3-7 H4 items under one H3. If an H3 needs many more, first check whether the H3 should split or whether the H4s are too granular.
46
- - Keep terminology natural for programming topics. Use names such as `Linked List`, `Linked Queue`, `Header Node`, or `BST` when those are clearer than forced translation.
47
-
48
- ## Authoring Workflow
49
-
50
- 1. Identify the whole document scope from the user request and existing metadata.
51
- 2. Choose H2 chapters first. For source material already organized by chapters or units, one source chapter usually becomes one H2, such as `CH4 Linked List`, `CH5 Tree`, `CH6 Graph`, `CH7 Sorting`.
52
- 3. Group each H2 into H3 topic groups that belong in the public TOC.
53
- 4. Move named algorithms, operations, theorem items, and implementation variants to H4.
54
- 5. Merge H4s that only separate conceptual explanation from the worked trace or implementation of the same operation.
55
- 6. Keep explanations, edge cases, teaching notes, and reasons in body prose, tables, figures, or code blocks.
56
- 7. Put internal planning, style-pack rules, and agent guidance in `skills/`, `memory/`, or `document/design.md`, not in public chapter MDX.
57
- 8. When hierarchy changes also affect explanation order, exercise design, captions, or student-facing wording, hand that part back to `openpress-writing` and the appropriate portable writing skill.
58
-
59
- ## File Strategy
60
-
61
- open-press scans `document/chapters/<NN-slug>/content/*.mdx` in chapter/file order. Chapter directories are durable editing units; file boundaries inside a chapter are editing boundaries, not necessarily book hierarchy boundaries.
62
-
63
- - A long H2 chapter may span multiple files.
64
- - Only the first file of that chapter needs the `##` heading.
65
- - Later files in the same chapter may start with `###` or `####`.
66
- - Use filename prefixes for ordering, not for visible hierarchy.
67
- - Frontmatter `title:` is an editor/source label; visible book structure is defined by Markdown headings.
68
-
69
- ## Data Structures Notes
70
-
71
- When the document is a data structures note, read `references/data-structures-outline.md` for the preferred H2/H3/H4 model. Treat it as structure memory, not public content.
72
-
73
- ## Completion Check
74
-
75
- Before finishing a structure pass:
76
-
77
- - use `openpress` for source scanning, validation, export, or render commands;
78
- - inspect headings and confirm the semantic structure matches the intended H2/H3/H4 model;
79
- - confirm public TOC is not overloaded with H4-level algorithm names;
80
- - confirm reader outline H4s are not dominated by tiny code fragments, figure labels, or repeated quiz labels;
81
- - confirm H2 chapters can scale when new units are added.
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "open-press Document Hierarchy"
3
- short_description: "Plan and revise long-form open-press heading hierarchy"
4
- default_prompt: "Use this skill to structure a open-press long-form document into H2 chapters, H3 topic groups, and H4 algorithms, procedures, or worked items."
@@ -1,115 +0,0 @@
1
- # Data Structures Document Outline
2
-
3
- Use this outline when expanding a open-press document from one data-structure topic into a full data structures note. Keep it as authoring memory; do not copy it into public pages as an internal plan.
4
-
5
- ## Heading Model
6
-
7
- - `## CH4 Linked List`
8
- - `### List、Node 與 Pointer`
9
- - `### Singly Linked List`
10
- - `#### Insert`
11
- - `#### Delete`
12
- - `#### Search`
13
- - `#### Reverse`
14
- - `#### Concatenate`
15
- - `### Linked Stack 與 Linked Queue`
16
- - `#### Linked Stack push / pop`
17
- - `#### Linked Queue add / delete`
18
- - `### Circular Linked List 與 Header Node`
19
- - `#### first / last entry design`
20
- - `#### Circular delete`
21
- - `#### Header Node operations`
22
- - `#### Josephus problem`
23
- - `### Polynomial 與 Sparse Matrix`
24
- - `#### Polynomial add`
25
- - `#### Polynomial multiply`
26
- - `#### Sparse matrix representation`
27
- - `### Doubly Linked List`
28
- - `#### Insert`
29
- - `#### Delete`
30
- - `#### Circular Doubly Linked List`
31
- - `### Practice`
32
-
33
- Keep chapter-local exercises and mock quizzes inside `### Practice` unless the assessment is large enough to become its own chapter. When the document grows into a multi-chapter book, prefer one of these patterns:
34
-
35
- - chapter-local practice inside each H2 chapter;
36
- - a global `## Practice` chapter for cumulative exercises;
37
- - a global `## Answer Appendix` chapter with H3 groups per source chapter.
38
-
39
- - `## CH5 Tree`
40
- - `### Tree Theorems`
41
- - `#### Theorem 1`
42
- - `#### Theorem 2`
43
- - `#### Theorem 3`
44
- - `### Traversal`
45
- - `#### Recursive traversal`
46
- - `#### Non-recursive traversal`
47
- - `#### Level-order traversal`
48
- - `### Heap`
49
- - `#### insert heap`
50
- - `#### delete heap`
51
- - `### Binary Search Tree`
52
- - `#### BST search`
53
- - `#### BST insert`
54
- - `#### BST delete`
55
- - `#### Copy tree`
56
- - `#### Verify equal trees`
57
- - `#### Count nodes`
58
- - `#### Count leaves`
59
- - `### AVL Tree`
60
- - `#### Left rotate`
61
- - `#### Right rotate`
62
- - `#### AVL insert`
63
- - `#### AVL delete`
64
- - `### Expression Conversion`
65
- - `#### Infix to prefix`
66
- - `#### Infix to postfix`
67
-
68
- - `## CH6 Graph`
69
- - `### DFS 與 BFS`
70
- - `#### DFS`
71
- - `#### DFS non-recursive`
72
- - `#### BFS`
73
- - `### Minimum Spanning Tree`
74
- - `#### Kruskal`
75
- - `#### Cycle detection by mask`
76
- - `#### Union and Find`
77
- - `#### Prim`
78
- - `### Shortest Path`
79
- - `#### Single-source shortest path Dijkstra`
80
- - `#### All pairs shortest paths`
81
- - `### Transitive Closure`
82
-
83
- - `## CH7 Sorting`
84
- - `### Elementary Sorts`
85
- - `#### Selection sort`
86
- - `#### Bubble sort`
87
- - `#### Insertion sort`
88
- - `### Quick Sort`
89
- - `#### Recursive quick sort`
90
- - `#### Non-recursive quick sort`
91
- - `### Merge Sort`
92
- - `#### Recursive merge sort`
93
- - `#### Non-recursive merge sort`
94
- - `### Heap Sort`
95
-
96
- - `## Appendix A: C/C++ Programming Notes`
97
- - `### Pointer Basics`
98
- - `### Arrays and Strings`
99
- - `### Function Parameters`
100
-
101
- Keep C/C++ syntax and programming-language refreshers in an appendix when they are reused across multiple data-structure chapters. Do not attach them to `CH4 Linked List` unless the note is intentionally a single-chapter handout.
102
-
103
- ## Teaching Block Pattern
104
-
105
- For an H4 algorithm/procedure, prefer this order:
106
-
107
- 1. Problem statement with input and output.
108
- 2. Data representation or invariant.
109
- 3. Pseudocode.
110
- 4. Worked trace or diagram.
111
- 5. C-like implementation.
112
- 6. Complexity and common mistake.
113
- 7. One practice prompt when useful.
114
-
115
- Keep these blocks inside the same H4 when they teach the same operation. For example, a trace table and the final C-like code for `Polynomial add` should not become separate H4 headings unless they are genuinely different topics.
@@ -1,84 +0,0 @@
1
- ---
2
- name: openpress-init
3
- description: Use when the user wants to start a new open-press project, set up a fresh document workspace, pick a style pack for a new document, bootstrap a new proposal/whitepaper/teaching-note/spec/book, or run the first-time initialization conversation before any content is written.
4
- ---
5
-
6
- # open-press Init
7
-
8
- This skill owns the **conversation that happens before `openpress init` runs**. Its job is to gather the minimum context needed to pick the right style pack and fill the right metadata, then hand off to downstream skills.
9
-
10
- It does not own writing, design, hierarchy, or deploy decisions — those belong to their specialist skills and only come into play after init completes.
11
-
12
- ## When To Enter
13
-
14
- Activate when the user says any of:
15
-
16
- - "新開一個 open-press 專案 / 文件"
17
- - "start a new open-press doc / project"
18
- - "我想寫一份 [提案 / 白皮書 / 論文 / 講義 / spec / 報告 / 書]"
19
- - "幫我起手"
20
- - Any request that implies an empty target directory and no chosen pack yet.
21
-
22
- Do **not** activate when the workspace already has `document/` populated. In that case route to the appropriate domain skill instead.
23
-
24
- ## Required Intake Questions
25
-
26
- Ask these before running `init`. Batch them; do not ask one at a time.
27
-
28
- | Question | Used to decide |
29
- | --- | --- |
30
- | 文件類型(提案 / 白皮書 / 論文 / 教學講義 / 工作筆記 / brief / spec / 書 / 其他) | Style pack recommendation, hierarchy expectation |
31
- | 目標讀者(內部團隊 / 客戶 / 學生 / 學術 / 公眾) | Tone register, portable skill triggers |
32
- | 主要語言(繁體中文 / English / 雙語) | Whether `chinese-ai-writing-polish` will load downstream |
33
- | 規模(單頁 brief / 多章長文 / 完整書 / 系列課程) | Style pack fit, chapter scaffold |
34
- | Metadata: `title` / `subtitle` / `organization` / `author` | Written directly into `openpress.config.mjs` and `document/index.tsx` |
35
-
36
- If the user already supplied any of these in the request, do not re-ask — only ask the gaps.
37
-
38
- ## Optional Questions (Ask Only When Relevant)
39
-
40
- - 是否需要 PDF 輸出(默認需要,僅在使用者明確只要 web 時跳過 PDF preflight)
41
- - 是否預定公開部署(會引入 `openpress-deploy` 後續流程)
42
- - 目標完成日期(影響後續工作節奏建議,不影響 init 本身)
43
-
44
- ## Style Pack Recommendation
45
-
46
- Map answers to pack choice:
47
-
48
- | 文件類型 + 規模 | 建議 pack |
49
- | --- | --- |
50
- | 提案書 / 白皮書 / 論文 / spec / 規格 / 多章長文 | `editorial-monograph` |
51
- | 工作筆記 / brief / 研究摘要 / 教學講義 / 內部備忘 / 單頁到中等長度 | `claude-document` |
52
- | 兩者邊界模糊時 | 給使用者兩個選項,附簡短差異描述(hairline vs warm paper),讓使用者選 |
53
-
54
- 當未來有更多 pack 時,更新這張表並同步 `openpress-style-pack-contributor`。
55
-
56
- ## Workflow
57
-
58
- 1. Read the user's opening message; extract any answers already given.
59
- 2. Ask only the **missing** intake questions in one batch.
60
- 3. Confirm style pack choice with one sentence of rationale (e.g. 「多章長白皮書 → 建議 `editorial-monograph`,hairline 風格適合長段閱讀」).
61
- 4. Run init via `openpress`:
62
- ```bash
63
- node engine/cli.mjs init <target> --skill <pack>
64
- ```
65
- `<target>` defaults to current workspace when empty; ask if unsure.
66
- 5. Fill metadata: edit `openpress.config.mjs` (title/subtitle/organization/author) and the same fields in `document/index.tsx` cover props.
67
- 6. Run `node engine/cli.mjs validate <target>` to confirm the workspace is healthy.
68
- 7. Hand off:
69
- - Tell the user what to edit next (`document/chapters/`, `document/index.tsx`, `document/theme/tokens.css`).
70
- - Name which downstream skill will pick up next requests: writing → `openpress-writing`, design → `openpress-design`, structure → `openpress-document-hierarchy`, deploy → `openpress-deploy`.
71
- - If 語言 is 繁體中文, mention that `chinese-ai-writing-polish` will load automatically during writing.
72
- - If 文件類型 is 教學講義, mention that `teaching-notes-writing` will load.
73
-
74
- ## Boundaries
75
-
76
- - `openpress` owns the `init` CLI itself and the source/generated boundary. This skill asks the questions; `openpress` runs the command.
77
- - `openpress-style-pack-contributor` owns designing new packs. This skill only consumes existing packs.
78
- - `openpress-writing` / `openpress-design` / `openpress-document-hierarchy` take over after init completes.
79
-
80
- ## Do Not
81
-
82
- - Do not run `init` before metadata is gathered. An empty workspace with `[TODO]` placeholders in cover is a worse starting state than a 30-second intake conversation.
83
- - Do not pick a style pack for the user when the answer is ambiguous; offer the two candidates.
84
- - Do not start writing content during init. Hand off cleanly.