@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,62 +0,0 @@
1
- ---
2
- name: openpress-style-pack-contributor
3
- description: Use when contributing, designing, creating, reviewing, or improving a open-press style pack, especially the visual philosophy, starter workspace, design doc, theme tokens, page surfaces, components, and validation for skills/<pack>/starter.
4
- ---
5
-
6
- # open-press Style Pack Contributor
7
-
8
- This skill owns **bundled style packs at the source** — everything under `skills/<pack>/`. A style pack is an opinionated document design system plus a runnable starter workspace. Use `openpress` for the exact init, validate, export, render, and scratch-workspace commands.
9
-
10
- The split with `openpress-design` is by path, not by topic:
11
-
12
- - `skills/<pack>/starter/document/…` → this skill (upstream, ships to every new workspace).
13
- - `document/…` in an end-user workspace → `openpress-design` (downstream, one project's local edits).
14
-
15
- ## Responsibilities
16
-
17
- - Define one clear visual philosophy for the pack.
18
- - Edit only `skills/<pack>/` unless the framework lacks a generic capability.
19
- - Provide a runnable `starter/` that the system-level `openpress` skill can initialize into a fresh target.
20
- - Keep starter `design.md` public-readable.
21
- - Preserve portable typography contracts: `theme/tokens.css` names `--openpress-font-*` tokens, `theme/fonts.css` loads faces, and `local(...)` alone is not enough for stable public output.
22
- - Validate the pack through a scratch workspace (do not overwrite the user's current `document/`).
23
-
24
- ## Boundaries
25
-
26
- - `openpress` owns CLI command choice and the source/generated boundary table.
27
- - `openpress-design` owns the same visual concerns but in workspace `document/`, not pack `starter/`.
28
- - `openpress-writing` owns starter content prose and factual boundaries.
29
-
30
- ## Pack Layout
31
-
32
- ```txt
33
- skills/<pack>/
34
- SKILL.md # visual signature, suitable-for, do/don't
35
- starter/
36
- openpress.config.mjs
37
- document/
38
- index.tsx
39
- chapters/
40
- design.md
41
- theme/
42
- components/
43
- media/
44
- ```
45
-
46
- Do not put generated output, private content, customer data, secrets, or deployment artifacts in a style pack.
47
-
48
- ## Workflow
49
-
50
- 1. Define intended document types, readers, and visual philosophy.
51
- 2. Keep the pack narrow; one pack should not serve every tone or industry.
52
- 3. Build or update `starter/`.
53
- 4. Ask `openpress` to choose and run the scratch-workspace validation workflow.
54
- 5. Ask `openpress` for broader framework checks only when shared code changes.
55
-
56
- ## Cross-Pack Discovery
57
-
58
- When adding a new pack, also update sibling pack SKILLs that overlap in audience so users can choose between them. Each pack SKILL should at minimum list its **suitable / not suitable** scope.
59
-
60
- ## When To Read References
61
-
62
- - Read `references/starter-contract.md` for starter file responsibilities, typography portability, validation expectations, and review checklist.
@@ -1,49 +0,0 @@
1
- # Style Pack Starter Contract
2
-
3
- ## Starter Responsibilities
4
-
5
- | Path | Responsibility |
6
- | --- | --- |
7
- | `starter/openpress.config.mjs` | root marker that points at `document/openpress.config.mjs` |
8
- | `starter/document/index.tsx` | React document entry: config plus cover, TOC, and back-cover shell JSX |
9
- | `starter/document/chapters/` | minimal coherent MDX chapters; optional chapter opener files |
10
- | `starter/document/design.md` | single public-readable design brief (style positioning, tokens, components, CSS responsibilities) |
11
- | `starter/document/theme/` | CSS tokens, fonts, base typography, page surfaces, patterns, shell rules, print safeguards |
12
- | `starter/document/theme/fonts.css` | font-face imports or self-hosted font rules |
13
- | `starter/document/theme/fonts/` | optional self-hosted `.woff2` files |
14
- | `starter/document/components/` | reusable structured visual units |
15
- | `starter/document/media/` | assets safe to ship with the pack |
16
-
17
- The engine discovers a style pack by the presence of `starter/`.
18
-
19
- Page surfaces are optional by document type. A report-focused pack can ship only cover, TOC, chapter, and back cover styling. A book/manual/teaching pack may also include `starter/document/theme/page-surfaces/chapter-opener.css` plus optional `chapter.tsx` opener exports. Chapter openers must be optional starter content, not a required page in every new workspace.
20
-
21
- ## Typography Portability
22
-
23
- Style packs own typography:
24
-
25
- - `theme/tokens.css` names font tokens and fallback stacks.
26
- - `theme/fonts.css` loads actual font faces.
27
- - `theme/fonts/` stores self-hosted files when the pack must work without a CDN.
28
-
29
- Do not rely on `local(...)` alone for public, mobile, iPad, or PDF-stable output. If a pack uses system fonts, document that output is not pixel-identical across devices.
30
-
31
- ## Validation Expectations
32
-
33
- Validate through a scratch workspace, but do not define the command sequence in this style-pack reference. Use `openpress` for init, validate, export, render, PDF, and broader framework check commands.
34
-
35
- Run PDF only when `openpress` determines the scratch workspace has the required app/runtime files. Run broader framework checks only when shared code changes.
36
-
37
- ## Review Checklist
38
-
39
- Before calling the pack ready, confirm:
40
-
41
- - one narrow, describable visual philosophy;
42
- - portable typography policy;
43
- - starter renders without missing assets or fonts;
44
- - `openpress` can initialize and validate the pack through the current system-level workflow;
45
- - dense paragraphs, tables, figures, captions, and long headings remain readable;
46
- - starter Markdown tables demonstrate `<TableCaption>...</TableCaption>` instead of legacy prose markers or hand-written table numbers;
47
- - PDF output does not overflow fixed pages when PDF validation is available;
48
- - `design.md` teaches users and agents how to review the pack;
49
- - no private content, customer data, tokens, or deploy secrets are included.
@@ -1,88 +0,0 @@
1
- ---
2
- name: openpress-update
3
- description: Use when updating or upgrading an existing open-press workspace to a newer framework release, pulling new engine/runtime changes, applying release migration notes, or handling breaking changes between versions.
4
- ---
5
-
6
- # open-press Update
7
-
8
- This skill owns the **release update flow** for an existing workspace: pulling new framework code, applying migration notes, handling breaking changes, and verifying nothing broke.
9
-
10
- It does not own first-time setup (that is `openpress-init`) and does not own content/design changes (those are domain skills).
11
-
12
- ## When To Enter
13
-
14
- Activate when the user says any of:
15
-
16
- - "升級 open-press / 更新到最新版"
17
- - "update open-press / upgrade to latest"
18
- - "拉新版的 engine"
19
- - "看一下這版有什麼破壞性改動"
20
- - After the user pulls a new git tag and asks to verify the workspace still works.
21
-
22
- ## Pre-Flight Check
23
-
24
- Before touching anything, confirm:
25
-
26
- 1. **Workspace state is clean**: `git status` shows no uncommitted document changes that an upgrade might overwrite.
27
- 2. **Current version is known**: read `package.json` `version` field; compare to target version.
28
- 3. **CHANGELOG has been read**: locate the project's CHANGELOG (currently in `docs/superpowers/specs/` migration notes; future: top-level `CHANGELOG.md`). Identify every breaking change between current and target version.
29
-
30
- If any of these are missing, surface to the user before proceeding.
31
-
32
- ## Current Update Surface (pre-`core/`)
33
-
34
- Until the `core/` folder restructure ships (tracked in `docs/superpowers/specs/2026-05-21-open-press-template-and-skill-init.md`), framework code lives intermixed with workspace code in this repo. Update means:
35
-
36
- 1. `git pull` (or merge / rebase the new framework tag).
37
- 2. `npm install` to refresh dependencies.
38
- 3. `npm run typecheck` — first signal of API-shape breakage.
39
- 4. `npm test` — second signal of behavior breakage.
40
- 5. `npm run openpress:validate && npm run openpress:render` against current `document/`.
41
- 6. For each failure, check the CHANGELOG entry for the breaking change and apply the documented migration.
42
-
43
- ## Future Update Surface (post-`core/`)
44
-
45
- When `core/` exists (planned, see spec):
46
-
47
- 1. Backup user-edited escape-hatch files under `src/` (workspace overrides via vite alias).
48
- 2. Overwrite `core/` wholesale from the new release.
49
- 3. Re-apply codemods listed in the release migration notes.
50
- 4. Verify with `typecheck` + `test` + `validate` + `render`.
51
-
52
- This skill will own the codemod runner once it exists.
53
-
54
- ## Breaking Change Handling
55
-
56
- For each breaking change in the CHANGELOG:
57
-
58
- | Change type | Action |
59
- | --- | --- |
60
- | Renamed identifier (e.g. `BaseReportPage` → `BaseContentPage`) | grep workspace for old name; rewrite at every callsite |
61
- | Removed export | grep workspace; ask user if replacement is acceptable |
62
- | Changed function signature | typecheck will surface; fix per release notes |
63
- | CSS class rename | grep `document/theme/` and `document/components/`; rewrite |
64
- | Config schema change | edit `openpress.config.mjs` per release notes |
65
- | Markdown / MDX directive change | grep `document/chapters/`; rewrite per release notes |
66
-
67
- If a breaking change has no documented migration in the CHANGELOG, **stop and ask the user** — do not improvise.
68
-
69
- ## Workflow
70
-
71
- 1. Pre-flight (clean tree, version delta, CHANGELOG read).
72
- 2. Pull the new code.
73
- 3. Run `typecheck` / `test` / `validate` / `render` in that order; stop at the first failure.
74
- 4. For each failure: find the CHANGELOG entry, apply the migration, re-run the failing command.
75
- 5. After all gates pass, run `npm run openpress:pdf` to sanity-check PDF output.
76
- 6. Report to the user: starting version, ending version, list of migrations applied, anything that needed manual intervention.
77
-
78
- ## Boundaries
79
-
80
- - `openpress` owns the CLI and the source/generated boundary. This skill uses those commands.
81
- - `openpress-deploy` is **not** part of update; do not auto-deploy after a successful update.
82
- - Domain skills (`openpress-writing` / `openpress-design`) handle non-mechanical content rewrites that the user wants to do alongside the upgrade.
83
-
84
- ## Do Not
85
-
86
- - Do not skip CHANGELOG reading. An undocumented breaking change is a sign to stop, not a sign to guess.
87
- - Do not bundle new feature work with an update. Land the update first, commit, then start new work.
88
- - Do not run `--force` overwrites on workspace files. If a file conflicts, surface it.
@@ -1,68 +0,0 @@
1
- ---
2
- name: openpress-writing
3
- description: "Use when planning, restructuring, drafting, rewriting, or editing open-press document content at the document level: audience, narrative, section order, table/figure captions, factual boundaries, and coordination with independent writing skills."
4
- ---
5
-
6
- # open-press Writing
7
-
8
- open-press writing owns the **reader-facing document argument**. It decides what the document should say, in what order, and what facts need confirmation. It is also the **entry point for portable writing skills** (tone, language, genre, teaching).
9
-
10
- ## Responsibilities
11
-
12
- - Define audience, purpose, narrative flow, and section order.
13
- - Rewrite prose, tables, captions, and content transitions.
14
- - Own the `<TableCaption>...</TableCaption>` placement rule (single authoritative definition; style packs link to this skill, not redefine it).
15
- - Decide when prose should become a table, figure, chart, or callout.
16
- - Preserve confirmed facts and mark missing facts explicitly.
17
- - Load portable writing skills based on content type (see triggers below).
18
- - Reference `openpress` for system operations, source/generated boundaries, and verification commands instead of defining them here.
19
-
20
- ## Boundaries
21
-
22
- | Owns | Boundary |
23
- | --- | --- |
24
- | `openpress` | CLI, inspect/search/replace, source/generated boundary |
25
- | `openpress-document-hierarchy` | H1/H2/H3/H4 structure, TOC depth, appendix placement |
26
- | `openpress-design` | theme CSS, visual systems, component styling |
27
- | `openpress-diagram-drawing` | what diagrams show |
28
- | Portable writing skills | language, tone, genre, teaching-specific rules |
29
-
30
- Source paths follow `openpress` > Source Boundary. Do not redefine them here.
31
-
32
- ## Coordination With Hierarchy
33
-
34
- When work might change `##` chapter splits, TOC depth, or H4 outline density, **route to `openpress-document-hierarchy` first**, then return here to write the prose. When writing reveals a need to split or merge headings, hand the structural change back to hierarchy.
35
-
36
- ## Portable Writing Skill Triggers
37
-
38
- Load a portable skill when content matches these conditions:
39
-
40
- | Content type | Load |
41
- | --- | --- |
42
- | Any Traditional Chinese professional content | `chinese-ai-writing-polish` |
43
- | Learner-facing teaching notes, worksheets, study guides, tutorial chapters | `teaching-notes-writing` |
44
- | (future) Business proposal / pitch / investor memo | dedicated portable skill |
45
- | (future) Academic report / paper | dedicated portable skill |
46
-
47
- Multiple portable skills may apply (e.g. 繁體中文 teaching notes load both). When two rules disagree, resolve in this order:
48
-
49
- 1. Explicit user instruction in the current conversation.
50
- 2. Workspace memory and preferences (e.g. `memory/AGENTS.md`, `document/design.md`).
51
- 3. Document brief or stated purpose.
52
- 4. `openpress-writing` structural decisions (audience, narrative, section order).
53
- 5. Portable skill rules.
54
-
55
- If the conflict changes meaning or claims, ask the user.
56
-
57
- ## Workflow
58
-
59
- 1. Identify audience, goal, fixed facts, and missing facts.
60
- 2. Check if hierarchy is affected; if so, coordinate with `openpress-document-hierarchy` first.
61
- 3. Load portable writing skills per the trigger table.
62
- 4. Rewrite source content without adding unsupported claims.
63
- 5. Mark unresolved facts as `[TODO: ...]`, `[FIX: ...]`, or `[DRAFT: ...]`.
64
- 6. Ask `openpress` which validation depth and commands are needed after content edits.
65
-
66
- ## When To Read References
67
-
68
- - Read `references/source-and-writing-rules.md` for frontmatter, metadata, unfinished markers, public-content boundaries, heading hygiene, formulas, captions, and starter document rules.
@@ -1,120 +0,0 @@
1
- # Source And Writing Rules
2
-
3
- ## Content Shape
4
-
5
- open-press scans React/MDX chapter content in chapter directory order:
6
-
7
- ```txt
8
- document/index.tsx
9
- document/chapters/
10
- 01-example/
11
- chapter.tsx optional meta/opener for book-like docs
12
- content/
13
- 01-start.mdx
14
- ```
15
-
16
- Document shell exports in `document/index.tsx`:
17
-
18
- - `config`: document identity and open-press paths.
19
- - `cover`: opening identity page.
20
- - `toc`: generated table of contents shell.
21
- - `backCover`: closing page.
22
-
23
- Chapter exports in `chapter.tsx`:
24
-
25
- - `meta`: optional `slug`, `title`, and tone/style metadata.
26
- - `opener`: optional chapter divider JSX for books, teaching notes, manuals, or loose chapter collections.
27
-
28
- Document-level identity belongs in `document/index.tsx` `config` and, for nested workspaces, matching `document/openpress.config.mjs` delivery settings:
29
-
30
- - `title`
31
- - `subtitle`
32
- - `organization`
33
- - `workspaceLabel`
34
-
35
- Do not move document identity into MDX frontmatter.
36
-
37
- ## Page Kind Boundaries
38
-
39
- Use source location to describe a page's role, not its topic:
40
-
41
- | Source | Use For | Footer |
42
- | --- | --- | --- |
43
- | `document/index.tsx` `cover` | document opening identity | no |
44
- | `document/index.tsx` `toc` | generated table of contents shell | no |
45
- | `chapter.tsx` `opener` | optional chapter divider / mini cover | no |
46
- | `content/*.mdx` | normal reader-facing sections split/paginated by blocks | yes |
47
- | `document/index.tsx` `backCover` | closing page | no |
48
-
49
- `opener` is not a substitute for `##` chapter content. It should introduce the next chapter with a title, short summary, or learning map, then the real chapter still starts in MDX. Do not add chapter openers to thesis/report-style documents unless the user asks for a book-like reading rhythm.
50
-
51
- ## Public Content Boundary
52
-
53
- Rendered open-press pages are for the intended reader. Avoid internal production notes in `document/chapters/` unless the document topic is explicitly open-press, agent workflows, style packs, or design documentation.
54
-
55
- Avoid accidental internal language such as `agent`, `skill`, `style pack`, `內部規則`, `給老師看`, `設計理由`, or `production note` in normal reader-facing chapters. Use `openpress` when source scanning is needed.
56
-
57
- ## Unfinished Content
58
-
59
- Use recognizable markers:
60
-
61
- ```txt
62
- [TODO: ...]
63
- [FIX: ...]
64
- [DRAFT: ...]
65
- ```
66
-
67
- Avoid bare `TODO`, `TBD`, or `[必填]`; they are harder to distinguish from normal prose.
68
-
69
- ## Heading Hygiene
70
-
71
- Headings are navigation labels. Keep `##` and `###` plain-text and semantic:
72
-
73
- - no backtick code spans;
74
- - no raw HTML tags;
75
- - no bold/italic Markdown;
76
- - no formulas as heading text.
77
-
78
- Move identifiers, formulas, commands, and API names into the paragraph after the heading. Before finishing a writing pass, ask `openpress` to scan headings for code spans, raw HTML, bold/italic Markdown, or formula-like labels when that risk is present.
79
-
80
- ## Formula Writing
81
-
82
- open-press renders LaTeX math. Use plain Markdown delimiters:
83
-
84
- - Inline: `$x^2$` or `\(x^2\)`.
85
- - Display: `$$ ... $$` or `\[ ... \]` on their own lines.
86
-
87
- If a formula string should remain literal, use code spans or code fences.
88
-
89
- ## Caption Contract
90
-
91
- open-press owns figure and table numbering. Components and Markdown content provide only semantic caption text; the renderer adds numbering such as `圖 N:` or `表 N:`.
92
-
93
- - Use at most one `<figcaption>` per `<figure>`.
94
- - Put visible captions after the visual body.
95
- - Put `<TableCaption>` immediately before any Markdown table that should be captioned:
96
- ```mdx
97
- <TableCaption>Pointer syntax</TableCaption>
98
-
99
- | 寫法 | 意義 |
100
- | --- | --- |
101
- | `p` | 節點位址 |
102
- ```
103
- - Do not use the legacy `表:...` marker, and do not write `表 1:`, `圖 2:`, `Figure 1`, or `Table 1` in source content. The visible number is generated from DOM order.
104
- - Empty `<TableCaption>` components, misplaced `<TableCaption>` components, and legacy `表:...` markers are compile errors.
105
- - Keep captions title-level; put long explanation in surrounding prose.
106
- - Do not draw figure/table numbers or explanatory prose inside chart panels.
107
-
108
- ## Starter Document Writing
109
-
110
- Use the active style pack starter and `document/design.md` when drafting a new or thin open-press workspace.
111
-
112
- A small starter document usually includes:
113
-
114
- - cover: title, subtitle, promise, summary;
115
- - TOC: placeholder only, because open-press injects entries;
116
- - chapter 1: purpose, audience, workflow;
117
- - chapter 2: validation, output, example table or list;
118
- - back cover: concise closing statement.
119
-
120
- Prefer user-provided facts. If facts are missing, write neutral operational content or explicit placeholders instead of inventing organizations, metrics, testimonials, dates, or commitments.
@@ -1,54 +0,0 @@
1
- ---
2
- name: teaching-notes-writing
3
- description: Use when drafting or revising learner-facing teaching notes, course handouts, worksheets, study guides, or tutorial chapters that need comparisons, step-by-step explanation, quick practice, worked examples, or answer appendices.
4
- ---
5
-
6
- # Teaching Notes Writing
7
-
8
- This is a **portable writing skill**: usable standalone, and loaded by `openpress-writing` when content is learner-facing teaching material (handouts, worksheets, study guides, tutorial chapters). `openpress-writing` owns the trigger and conflict-resolution rules.
9
-
10
- Teaching notes are for learners who are still building the mental model. This skill provides **suggested content skeletons**, explanation strategies, examples, practice ideas, and answer-flow guidance. It does not mandate one rigid chapter template.
11
-
12
- ## Responsibilities
13
-
14
- - Start from the learner's likely mental model.
15
- - Compare nearby ideas before introducing formal rules.
16
- - Show procedures step by step with visible state changes.
17
- - Put reasons, warnings, and interpretation in prose rather than overloading figures.
18
- - Suggest practice surfaces that match the chapter content.
19
- - Put answers after the learner has had a chance to try.
20
- - Suggest when a structure, relationship, or state change should become a diagram; use `openpress-diagram-drawing` for the actual diagram semantics.
21
-
22
- ## Boundaries
23
-
24
- - `openpress-writing` owns open-press source boundaries and public-content hygiene.
25
- - `openpress-document-hierarchy` owns H1/H2/H3/H4 structure for long-form open-press notes.
26
- - `openpress-diagram-drawing` owns diagram semantics.
27
- - `openpress-design` owns visual style and component implementation.
28
- - `openpress` owns CLI, validation/export/render commands, and source/generated boundaries.
29
- - This skill owns learner-facing explanation suggestions and exercise-design patterns only.
30
-
31
- ## Suggested Skeleton
32
-
33
- Use this as a starting skeleton, not a required template:
34
-
35
- 1. Start from the learner's concrete problem or confusion.
36
- 2. Compare nearby concepts, states, or representations.
37
- 3. Show the operation or idea step by step.
38
- 4. Add one small check, trace, or practice task when it helps.
39
- 5. Put full answers after the learner has had a chance to attempt.
40
-
41
- If the concept depends on spatial structure, ownership, arrows, state transitions, or before/after relationships, hand the visual semantics to `openpress-diagram-drawing`.
42
-
43
- ## Learner Boundary
44
-
45
- Rendered teaching pages should speak to the learner, not the teacher or agent.
46
-
47
- - Do not include teacher-only reminders, production notes, internal rationale, or style-pack commentary.
48
- - Keep internal rules in skills, design docs, or source references.
49
- - Use consistent terms and variable names across prose, diagrams, tables, and code.
50
-
51
- ## When To Read References
52
-
53
- - Read `references/teaching-patterns.md` for comparison writing, explanation order, practice question types, and answer placement.
54
- - Read `references/programming.md` when teaching code, pseudocode, data structures, pointer diagrams, memory state, or program traces.
@@ -1,65 +0,0 @@
1
- # Programming Teaching Reference
2
-
3
- Use this reference with `teaching-notes-writing` when the learning material teaches programming, algorithms, data structures, memory state, or code tracing.
4
-
5
- ## Long Code Teaching Flow
6
-
7
- When a section introduces a long program, avoid dropping the full code block first. Use this order:
8
-
9
- 1. State the problem the code solves.
10
- 2. Show the data shape first, usually a `struct`, record, class, type definition, or table of variables.
11
- 3. Explain helper functions one at a time.
12
- 4. Present the core algorithm or function after students know the supporting pieces.
13
- 5. Add a complete version at the end, including `main` or an equivalent entry point when the language uses one.
14
- 6. Show a small expected output or state trace so students know how to verify the program.
15
-
16
- ## Heading Hierarchy For Course Notes
17
-
18
- - Use `#` only for the whole document title, usually on the cover or in metadata.
19
- - Use `##` for formal chapters such as `CH5 Tree`, `CH6 Graph`, or `CH7 Sorting`.
20
- - Use `###` for major topic groups that should appear in the formal table of contents, such as `Traversal`, `BST`, `MST`, or `Sorting Algorithms`.
21
- - Use `####` for concrete algorithms, operations, theorem items, or implementation variants, such as `BST delete`, `left rotate`, `quick sort (non-recursive)`, or `Theorem 1`.
22
- - Do not promote every algorithm to `##`; a long course note needs stable hierarchy more than large titles.
23
-
24
- ## Code Block Rules
25
-
26
- - A code block should have a clear local purpose before it appears.
27
- - Prefer several short code blocks for teaching, then one complete code block for integration.
28
- - Keep identifiers consistent across prose, tables, diagrams, and code.
29
- - Use comments only when they explain a non-obvious step. Do not comment every assignment.
30
- - When dynamic memory or external resources are involved, include cleanup in the complete version if the language requires it.
31
- - If a simplified example omits error handling or cleanup, state the omission explicitly. Prefer not omitting them in final code.
32
-
33
- ## Pseudocode Rules
34
-
35
- - Pseudocode should look like an algorithm, not a compressed prose note.
36
- - Include `Algorithm`, `Input`, and `Output` when the block represents a complete procedure.
37
- - Use indentation to show loops and branches.
38
- - Name operations by intent, such as `append_term`, `poly_add`, `clear`, or `return`, instead of vague verbs.
39
- - Keep pseudocode close enough to implementation that students can map it back to the final program.
40
-
41
- ## Programming Diagram And Table Pairing
42
-
43
- - Use markdown tables for dense comparisons, coefficient tables, state traces, and step-by-step logs.
44
- - Suggest custom open-press components for visual relationships: node links, pointer movement, memory layout, before/after states, and flow diagrams.
45
- - Use `openpress-diagram-drawing` to decide what belongs inside those visuals.
46
- - Do not combine a large table and a large diagram into one oversized image. Split them so each surface has one reading job.
47
- - Full-width figures are acceptable when a diagram contains multiple linked nodes or state rows.
48
-
49
- ## Technical Term Usage
50
-
51
- - Do not force every programming term into Chinese.
52
- - Use common English terms when students will also see them in code, exams, online judges, IDEs, or English documentation.
53
- - For major concepts, use English first with a local-language bridge on first mention: `Linked List(鏈結串列)`, `Singly Linked List(單向鏈結串列)`, `Doubly Linked List(雙向鏈結串列)`, `Circular Linked List(環狀串列)`, `Header Node(開頭空白節點)`.
54
- - After a concept is established, keep the English term in headings, tables, diagrams, and code-adjacent prose when that is what students will see elsewhere.
55
- - Use the local language when explaining reasoning, constraints, and student-facing guidance.
56
-
57
- ## Completion Check
58
-
59
- Before finishing a programming teaching pass:
60
-
61
- - verify long code sections have both breakdown and complete integration;
62
- - check that pseudocode, code, diagrams, and tables use the same identifiers;
63
- - confirm examples include an expected output, final state, or trace when useful;
64
- - check that simplified code does not silently omit cleanup or safety checks students need to learn;
65
- - use `openpress` for any workspace validation, export, render, or source/generated boundary questions.
@@ -1,60 +0,0 @@
1
- # Teaching Patterns
2
-
3
- ## Comparison Writing
4
-
5
- Use comparison when a concept is abstract, easily confused, or representation-dependent.
6
-
7
- | Surface | Best For |
8
- | --- | --- |
9
- | paragraph | one conceptual difference |
10
- | table | several aligned dimensions |
11
- | figure | spatial or directional relationship |
12
- | state trace | repeated algorithm steps |
13
- | code block | exact syntax or implementation |
14
-
15
- Avoid comparing too many things at once. If a table grows past one reading job, split it.
16
-
17
- ## Suggested Explanation Skeletons
18
-
19
- These are reusable starting points, not mandatory page templates. Adjust the order when the learner's prior knowledge or the source material demands it.
20
-
21
- For a concept:
22
-
23
- 1. why it appears;
24
- 2. small concrete example;
25
- 3. representation or vocabulary;
26
- 4. diagram or table;
27
- 5. formal rule, formula, or code;
28
- 6. common mistake;
29
- 7. quick practice.
30
-
31
- For a procedure:
32
-
33
- 1. initial state;
34
- 2. state-changing steps;
35
- 3. final state;
36
- 4. why order matters;
37
- 5. matching code or formula;
38
- 6. practice trace with another input.
39
-
40
- ## Visual And Text Roles
41
-
42
- - Use diagrams for relationships, directions, and state changes.
43
- - Use `openpress-diagram-drawing` when a structural visual, state diagram, pointer diagram, process diagram, or before/after figure is needed.
44
- - Use tables for dense comparisons and traces.
45
- - Use prose for reasons, warnings, edge cases, and interpretation.
46
- - Use code/math blocks for exact syntax, formulas, or runnable fragments.
47
- - Keep captions short; they name what to observe.
48
-
49
- ## Practice Design
50
-
51
- Useful question types:
52
-
53
- - quick recall;
54
- - comparison;
55
- - state trace;
56
- - bug finding;
57
- - implementation;
58
- - explanation of why a step must happen before another.
59
-
60
- Answers can be inline only for tiny checks. For chapter-level exercises, prefer an answer appendix before the back cover.