@open-press/cli 0.8.0 → 1.1.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 (250) hide show
  1. package/README.md +33 -23
  2. package/dist/cli.js +320 -252
  3. package/package.json +9 -8
  4. package/template/core/AGENTS.md +0 -126
  5. package/template/core/CHANGELOG.md +0 -215
  6. package/template/core/README.md +0 -40
  7. package/template/core/engine/cli.mjs +0 -96
  8. package/template/core/engine/commands/_shared.mjs +0 -177
  9. package/template/core/engine/commands/deploy.mjs +0 -31
  10. package/template/core/engine/commands/dev.mjs +0 -49
  11. package/template/core/engine/commands/doctor.mjs +0 -229
  12. package/template/core/engine/commands/export.mjs +0 -8
  13. package/template/core/engine/commands/init.mjs +0 -24
  14. package/template/core/engine/commands/inspect.mjs +0 -35
  15. package/template/core/engine/commands/pdf.mjs +0 -26
  16. package/template/core/engine/commands/preview.mjs +0 -26
  17. package/template/core/engine/commands/render.mjs +0 -17
  18. package/template/core/engine/commands/replace.mjs +0 -41
  19. package/template/core/engine/commands/search.mjs +0 -33
  20. package/template/core/engine/commands/typecheck.mjs +0 -5
  21. package/template/core/engine/commands/upgrade.mjs +0 -159
  22. package/template/core/engine/commands/validate.mjs +0 -17
  23. package/template/core/engine/document-export.mjs +0 -15
  24. package/template/core/engine/init.mjs +0 -90
  25. package/template/core/engine/output/chrome-pdf.d.mts +0 -34
  26. package/template/core/engine/output/chrome-pdf.mjs +0 -358
  27. package/template/core/engine/output/deploy-sync.mjs +0 -15
  28. package/template/core/engine/output/fonts.mjs +0 -62
  29. package/template/core/engine/output/katex-assets.mjs +0 -45
  30. package/template/core/engine/output/page-block.mjs +0 -30
  31. package/template/core/engine/output/pdf-media.mjs +0 -45
  32. package/template/core/engine/output/public-assets.mjs +0 -19
  33. package/template/core/engine/output/static-server.mjs +0 -532
  34. package/template/core/engine/react/caption-numbering.mjs +0 -73
  35. package/template/core/engine/react/comment-endpoint.d.mts +0 -11
  36. package/template/core/engine/react/comment-endpoint.mjs +0 -102
  37. package/template/core/engine/react/comment-marker.mjs +0 -374
  38. package/template/core/engine/react/document-entry.mjs +0 -324
  39. package/template/core/engine/react/document-export.mjs +0 -373
  40. package/template/core/engine/react/http-json.mjs +0 -24
  41. package/template/core/engine/react/mdx-compile.mjs +0 -599
  42. package/template/core/engine/react/measurement-css.mjs +0 -136
  43. package/template/core/engine/react/object-entities.mjs +0 -119
  44. package/template/core/engine/react/pagination/allocator.mjs +0 -122
  45. package/template/core/engine/react/pagination/regions.mjs +0 -81
  46. package/template/core/engine/react/pagination-constants.mjs +0 -3
  47. package/template/core/engine/react/pagination.mjs +0 -9
  48. package/template/core/engine/react/pipeline/allocate.mjs +0 -251
  49. package/template/core/engine/react/pipeline/final-render.mjs +0 -94
  50. package/template/core/engine/react/pipeline/frame-measurement.mjs +0 -302
  51. package/template/core/engine/react/pipeline/press-tree.mjs +0 -135
  52. package/template/core/engine/react/project-asset-endpoint.d.mts +0 -10
  53. package/template/core/engine/react/project-asset-endpoint.mjs +0 -361
  54. package/template/core/engine/react/section-css.mjs +0 -56
  55. package/template/core/engine/react/source-edit-endpoint.d.mts +0 -10
  56. package/template/core/engine/react/source-edit-endpoint.mjs +0 -75
  57. package/template/core/engine/react/sources/heading-numbering.mjs +0 -132
  58. package/template/core/engine/react/sources/mdx-resolver.mjs +0 -439
  59. package/template/core/engine/react/style-discovery.mjs +0 -142
  60. package/template/core/engine/runtime/config.d.mts +0 -40
  61. package/template/core/engine/runtime/config.mjs +0 -175
  62. package/template/core/engine/runtime/file-utils.mjs +0 -106
  63. package/template/core/engine/runtime/file-walk.mjs +0 -22
  64. package/template/core/engine/runtime/inspection.mjs +0 -328
  65. package/template/core/engine/runtime/issue-report.mjs +0 -44
  66. package/template/core/engine/runtime/path-utils.mjs +0 -20
  67. package/template/core/engine/runtime/source-text-tools.d.mts +0 -102
  68. package/template/core/engine/runtime/source-text-tools.mjs +0 -832
  69. package/template/core/engine/runtime/source-workspace.mjs +0 -159
  70. package/template/core/engine/runtime/validation.mjs +0 -174
  71. package/template/core/index.html +0 -13
  72. package/template/core/openpress.config.mjs +0 -12
  73. package/template/core/package.json +0 -91
  74. package/template/core/src/main.tsx +0 -16
  75. package/template/core/src/openpress/app/OpenPressApp.tsx +0 -140
  76. package/template/core/src/openpress/app/OpenPressRuntime.tsx +0 -94
  77. package/template/core/src/openpress/app/index.ts +0 -2
  78. package/template/core/src/openpress/core/Frame.tsx +0 -78
  79. package/template/core/src/openpress/core/FrameContext.tsx +0 -24
  80. package/template/core/src/openpress/core/MdxArea.tsx +0 -34
  81. package/template/core/src/openpress/core/Press.tsx +0 -34
  82. package/template/core/src/openpress/core/cn.ts +0 -4
  83. package/template/core/src/openpress/core/index.tsx +0 -40
  84. package/template/core/src/openpress/core/primitives.tsx +0 -44
  85. package/template/core/src/openpress/core/types.ts +0 -191
  86. package/template/core/src/openpress/core/useSource.ts +0 -28
  87. package/template/core/src/openpress/document-model/anchorMapModel.ts +0 -27
  88. package/template/core/src/openpress/document-model/documentIndexes.ts +0 -329
  89. package/template/core/src/openpress/document-model/documentTypes.ts +0 -138
  90. package/template/core/src/openpress/document-model/index.ts +0 -6
  91. package/template/core/src/openpress/document-model/objectEntityModel.ts +0 -51
  92. package/template/core/src/openpress/document-model/projectIdentityModel.ts +0 -15
  93. package/template/core/src/openpress/document-model/reactDocumentMetadataModel.ts +0 -27
  94. package/template/core/src/openpress/manuscript/index.tsx +0 -238
  95. package/template/core/src/openpress/mdx/index.ts +0 -88
  96. package/template/core/src/openpress/numbering/index.ts +0 -294
  97. package/template/core/src/openpress/reader/PublicReaderPage.tsx +0 -267
  98. package/template/core/src/openpress/reader/ReaderNavigationPanel.tsx +0 -123
  99. package/template/core/src/openpress/reader/index.ts +0 -10
  100. package/template/core/src/openpress/reader/pageViewportScaleModel.ts +0 -73
  101. package/template/core/src/openpress/reader/readerPageRegistry.ts +0 -41
  102. package/template/core/src/openpress/reader/readerPageRoute.ts +0 -21
  103. package/template/core/src/openpress/reader/readerScroll.ts +0 -92
  104. package/template/core/src/openpress/reader/readerStateModel.ts +0 -15
  105. package/template/core/src/openpress/reader/readerTypes.ts +0 -4
  106. package/template/core/src/openpress/reader/usePageViewportScale.ts +0 -119
  107. package/template/core/src/openpress/reader/usePanelState.ts +0 -56
  108. package/template/core/src/openpress/reader/useReaderHashSync.ts +0 -61
  109. package/template/core/src/openpress/reader/useReaderKeyboardNav.ts +0 -48
  110. package/template/core/src/openpress/reader/useReaderRuntime.ts +0 -146
  111. package/template/core/src/openpress/reader/useReaderScrollAnchor.ts +0 -64
  112. package/template/core/src/openpress/shared/Panel.tsx +0 -77
  113. package/template/core/src/openpress/shared/frameScheduler.ts +0 -32
  114. package/template/core/src/openpress/shared/index.ts +0 -4
  115. package/template/core/src/openpress/shared/numberUtils.ts +0 -3
  116. package/template/core/src/openpress/shared/runtimeMode.ts +0 -11
  117. package/template/core/src/openpress/workbench/Workbench.tsx +0 -407
  118. package/template/core/src/openpress/workbench/actions/DeploymentControl.tsx +0 -157
  119. package/template/core/src/openpress/workbench/actions/PageZoomControl.tsx +0 -182
  120. package/template/core/src/openpress/workbench/actions/SearchControl.tsx +0 -345
  121. package/template/core/src/openpress/workbench/actions/deploymentStatusModel.ts +0 -112
  122. package/template/core/src/openpress/workbench/actions/index.ts +0 -5
  123. package/template/core/src/openpress/workbench/actions/useDeploymentWorkbench.ts +0 -136
  124. package/template/core/src/openpress/workbench/dialog/WorkbenchDialog.tsx +0 -72
  125. package/template/core/src/openpress/workbench/dialog/index.ts +0 -1
  126. package/template/core/src/openpress/workbench/document/components/DocumentPanel.tsx +0 -127
  127. package/template/core/src/openpress/workbench/document/components/InlineSourceEditorLayer.tsx +0 -207
  128. package/template/core/src/openpress/workbench/document/components/ReaderStage.tsx +0 -9
  129. package/template/core/src/openpress/workbench/document/hooks/useDocumentWorkbenchModel.ts +0 -34
  130. package/template/core/src/openpress/workbench/document/hooks/useInlineDocumentEditor.ts +0 -525
  131. package/template/core/src/openpress/workbench/document/index.ts +0 -10
  132. package/template/core/src/openpress/workbench/index.ts +0 -2
  133. package/template/core/src/openpress/workbench/inspector/InlineInspectorLayer.tsx +0 -459
  134. package/template/core/src/openpress/workbench/inspector/index.ts +0 -5
  135. package/template/core/src/openpress/workbench/inspector/inlineCommentModel.ts +0 -125
  136. package/template/core/src/openpress/workbench/inspector/inspectorGeometryModel.ts +0 -160
  137. package/template/core/src/openpress/workbench/inspector/inspectorModel.ts +0 -408
  138. package/template/core/src/openpress/workbench/inspector/useInspectorComments.ts +0 -248
  139. package/template/core/src/openpress/workbench/mentions/MentionSuggestionList.tsx +0 -41
  140. package/template/core/src/openpress/workbench/mentions/index.ts +0 -2
  141. package/template/core/src/openpress/workbench/mentions/useComposerMentions.ts +0 -185
  142. package/template/core/src/openpress/workbench/panels/Panel.tsx +0 -1
  143. package/template/core/src/openpress/workbench/panels/PendingCommentsPanel.tsx +0 -76
  144. package/template/core/src/openpress/workbench/panels/WorkbenchControlPanel.tsx +0 -29
  145. package/template/core/src/openpress/workbench/panels/index.ts +0 -3
  146. package/template/core/src/openpress/workbench/project/ProjectEntryPanel.tsx +0 -523
  147. package/template/core/src/openpress/workbench/project/ProjectPreviewDialog.tsx +0 -35
  148. package/template/core/src/openpress/workbench/project/index.ts +0 -2
  149. package/template/core/src/openpress/workbench/project/projectPreviewTypes.ts +0 -11
  150. package/template/core/src/openpress/workbench/project/projectSourceModel.ts +0 -24
  151. package/template/core/src/openpress/workbench/shell/WorkbenchShell.tsx +0 -167
  152. package/template/core/src/openpress/workbench/shell/index.ts +0 -1
  153. package/template/core/src/openpress/workbench/workbenchFormatters.ts +0 -120
  154. package/template/core/src/openpress/workbench/workbenchTypes.ts +0 -35
  155. package/template/core/src/styles/openpress/app-shell.css +0 -251
  156. package/template/core/src/styles/openpress/media-workspace.css +0 -230
  157. package/template/core/src/styles/openpress/print-route.css +0 -184
  158. package/template/core/src/styles/openpress/project-preview-panel.css +0 -924
  159. package/template/core/src/styles/openpress/public-viewer.css +0 -688
  160. package/template/core/src/styles/openpress/reader-runtime.css +0 -980
  161. package/template/core/src/styles/openpress/responsive.css +0 -245
  162. package/template/core/src/styles/openpress/workbench-panels.css +0 -594
  163. package/template/core/src/styles/openpress/workbench.css +0 -1255
  164. package/template/core/src/styles/openpress.css +0 -14
  165. package/template/core/src/vite-env.d.ts +0 -9
  166. package/template/core/tsconfig.json +0 -40
  167. package/template/core/vite.config.ts +0 -584
  168. package/template/packs/academic-paper/document/chapters/01-introduction/content/01-introduction.mdx +0 -35
  169. package/template/packs/academic-paper/document/chapters/02-methods/content/01-methods.mdx +0 -50
  170. package/template/packs/academic-paper/document/chapters/03-results-and-discussion/content/01-results.mdx +0 -47
  171. package/template/packs/academic-paper/document/chapters/04-acknowledgment/content/01-acknowledgment.mdx +0 -26
  172. package/template/packs/academic-paper/document/chapters/05-references/content/01-references.mdx +0 -32
  173. package/template/packs/academic-paper/document/components/ChapterOpenerVisual/index.tsx +0 -76
  174. package/template/packs/academic-paper/document/components/Page.tsx +0 -60
  175. package/template/packs/academic-paper/document/components/TokenSwatchGrid/index.tsx +0 -46
  176. package/template/packs/academic-paper/document/components/TokenSwatchGrid/style.css +0 -63
  177. package/template/packs/academic-paper/document/components/TypeSpecimen/index.tsx +0 -38
  178. package/template/packs/academic-paper/document/components/TypeSpecimen/style.css +0 -111
  179. package/template/packs/academic-paper/document/design.md +0 -279
  180. package/template/packs/academic-paper/document/index.tsx +0 -123
  181. package/template/packs/academic-paper/document/media/README.md +0 -13
  182. package/template/packs/academic-paper/document/media/figure-placeholder.svg +0 -9
  183. package/template/packs/academic-paper/document/openpress.config.mjs +0 -26
  184. package/template/packs/academic-paper/document/theme/README.md +0 -11
  185. package/template/packs/academic-paper/document/theme/base/page-contract.css +0 -522
  186. package/template/packs/academic-paper/document/theme/base/print.css +0 -93
  187. package/template/packs/academic-paper/document/theme/base/typography.css +0 -333
  188. package/template/packs/academic-paper/document/theme/fonts.css +0 -3
  189. package/template/packs/academic-paper/document/theme/page-surfaces/back-cover.css +0 -43
  190. package/template/packs/academic-paper/document/theme/page-surfaces/chapter-opener.css +0 -205
  191. package/template/packs/academic-paper/document/theme/page-surfaces/cover.css +0 -294
  192. package/template/packs/academic-paper/document/theme/page-surfaces/toc.css +0 -149
  193. package/template/packs/academic-paper/document/theme/patterns/_chart-frame.css +0 -49
  194. package/template/packs/academic-paper/document/theme/patterns/figure-grid.css +0 -68
  195. package/template/packs/academic-paper/document/theme/patterns/table-utilities.css +0 -66
  196. package/template/packs/academic-paper/document/theme/shell/reader-controls.css +0 -761
  197. package/template/packs/academic-paper/document/theme/tokens.css +0 -80
  198. package/template/packs/academic-paper/openpress.config.mjs +0 -5
  199. package/template/packs/claude-document/document/chapters/01-document-shape/content/01-document-shape.mdx +0 -51
  200. package/template/packs/claude-document/document/chapters/02-review-loop/content/01-review-loop.mdx +0 -31
  201. package/template/packs/claude-document/document/components/ChapterOpenerVisual.tsx +0 -96
  202. package/template/packs/claude-document/document/components/Page.tsx +0 -37
  203. package/template/packs/claude-document/document/design.md +0 -142
  204. package/template/packs/claude-document/document/index.tsx +0 -94
  205. package/template/packs/claude-document/document/media/README.md +0 -13
  206. package/template/packs/claude-document/document/openpress.config.mjs +0 -26
  207. package/template/packs/claude-document/document/theme/README.md +0 -15
  208. package/template/packs/claude-document/document/theme/base/page-contract.css +0 -525
  209. package/template/packs/claude-document/document/theme/base/print.css +0 -93
  210. package/template/packs/claude-document/document/theme/base/typography.css +0 -612
  211. package/template/packs/claude-document/document/theme/fonts.css +0 -4
  212. package/template/packs/claude-document/document/theme/page-surfaces/back-cover.css +0 -72
  213. package/template/packs/claude-document/document/theme/page-surfaces/chapter-opener.css +0 -236
  214. package/template/packs/claude-document/document/theme/page-surfaces/cover.css +0 -309
  215. package/template/packs/claude-document/document/theme/page-surfaces/toc.css +0 -225
  216. package/template/packs/claude-document/document/theme/patterns/_chart-frame.css +0 -53
  217. package/template/packs/claude-document/document/theme/patterns/figure-grid.css +0 -68
  218. package/template/packs/claude-document/document/theme/patterns/table-utilities.css +0 -66
  219. package/template/packs/claude-document/document/theme/shell/reader-controls.css +0 -789
  220. package/template/packs/claude-document/document/theme/tokens.css +0 -89
  221. package/template/packs/claude-document/openpress.config.mjs +0 -5
  222. package/template/packs/editorial-monograph/document/chapters/01-product-and-use-cases/content/01-product-and-use-cases.mdx +0 -31
  223. package/template/packs/editorial-monograph/document/chapters/02-workflow/content/01-workflow.mdx +0 -89
  224. package/template/packs/editorial-monograph/document/chapters/03-agent-skills-contributors/content/01-agent-skills-contributors.mdx +0 -51
  225. package/template/packs/editorial-monograph/document/chapters/04-validation-deploy/content/01-validation-deploy.mdx +0 -39
  226. package/template/packs/editorial-monograph/document/components/ChapterOpenerVisual/index.tsx +0 -76
  227. package/template/packs/editorial-monograph/document/components/Page.tsx +0 -37
  228. package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/index.tsx +0 -46
  229. package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/style.css +0 -63
  230. package/template/packs/editorial-monograph/document/components/TypeSpecimen/index.tsx +0 -38
  231. package/template/packs/editorial-monograph/document/components/TypeSpecimen/style.css +0 -111
  232. package/template/packs/editorial-monograph/document/design.md +0 -279
  233. package/template/packs/editorial-monograph/document/index.tsx +0 -97
  234. package/template/packs/editorial-monograph/document/media/README.md +0 -13
  235. package/template/packs/editorial-monograph/document/openpress.config.mjs +0 -26
  236. package/template/packs/editorial-monograph/document/theme/README.md +0 -11
  237. package/template/packs/editorial-monograph/document/theme/base/page-contract.css +0 -505
  238. package/template/packs/editorial-monograph/document/theme/base/print.css +0 -93
  239. package/template/packs/editorial-monograph/document/theme/base/typography.css +0 -336
  240. package/template/packs/editorial-monograph/document/theme/fonts.css +0 -3
  241. package/template/packs/editorial-monograph/document/theme/page-surfaces/back-cover.css +0 -43
  242. package/template/packs/editorial-monograph/document/theme/page-surfaces/chapter-opener.css +0 -205
  243. package/template/packs/editorial-monograph/document/theme/page-surfaces/cover.css +0 -147
  244. package/template/packs/editorial-monograph/document/theme/page-surfaces/toc.css +0 -149
  245. package/template/packs/editorial-monograph/document/theme/patterns/_chart-frame.css +0 -49
  246. package/template/packs/editorial-monograph/document/theme/patterns/figure-grid.css +0 -68
  247. package/template/packs/editorial-monograph/document/theme/patterns/table-utilities.css +0 -66
  248. package/template/packs/editorial-monograph/document/theme/shell/reader-controls.css +0 -761
  249. package/template/packs/editorial-monograph/document/theme/tokens.css +0 -80
  250. package/template/packs/editorial-monograph/openpress.config.mjs +0 -5
@@ -1,14 +0,0 @@
1
- @import url("/openpress/fonts.css");
2
- @import url("/openpress/tokens.css");
3
- @import url("/openpress/content.css");
4
- @import url("/openpress/components.css");
5
-
6
- @import "./openpress/app-shell.css";
7
- @import "./openpress/workbench.css";
8
- @import "./openpress/workbench-panels.css";
9
- @import "./openpress/project-preview-panel.css";
10
- @import "./openpress/media-workspace.css";
11
- @import "./openpress/reader-runtime.css";
12
- @import "./openpress/public-viewer.css";
13
- @import "./openpress/responsive.css";
14
- @import "./openpress/print-route.css";
@@ -1,9 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- // Workspace path constants injected by vite.config.ts at build time.
4
- // These come from openpress.config.mjs so the React app reflects the user's
5
- // configured documentDir / sourceDir / mediaDir / componentsDir.
6
- declare const __OPENPRESS_CONTENT_PATH__: string;
7
- declare const __OPENPRESS_MEDIA_PATH__: string;
8
- declare const __OPENPRESS_COMPONENTS_PATH__: string;
9
- declare const __OPENPRESS_PDF_HREF__: string;
@@ -1,40 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "useDefineForClassFields": true,
5
- "lib": ["DOM", "DOM.Iterable", "ES2022"],
6
- "allowJs": false,
7
- "skipLibCheck": true,
8
- "esModuleInterop": true,
9
- "allowSyntheticDefaultImports": true,
10
- "strict": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "module": "ESNext",
13
- "moduleResolution": "Bundler",
14
- "types": ["node", "vite/client"],
15
- "resolveJsonModule": true,
16
- "isolatedModules": true,
17
- "noEmit": true,
18
- "jsx": "react-jsx",
19
- "paths": {
20
- "@open-press/core": ["./src/openpress/core/index.tsx"],
21
- "@open-press/core/mdx": ["./src/openpress/mdx/index.ts"],
22
- "@open-press/core/manuscript": ["./src/openpress/manuscript/index.tsx"],
23
- "@open-press/core/numbering": ["./src/openpress/numbering/index.ts"],
24
- "@/components": ["./document/components/index.ts", "./document/components/index.tsx"],
25
- "@/components/*": ["./document/components/*"],
26
- "@/*": ["./src/*"]
27
- }
28
- },
29
- "include": [
30
- "src",
31
- "document/**/*.ts",
32
- "document/**/*.tsx",
33
- "tests/**/*.test.ts",
34
- "tests/**/*.test.tsx",
35
- "tests/e2e/**/*.spec.ts",
36
- "vite.config.ts",
37
- "vitest.config.ts",
38
- "playwright.reader.config.ts"
39
- ]
40
- }
@@ -1,584 +0,0 @@
1
- import { fileURLToPath, URL } from "node:url";
2
- import { spawn } from "node:child_process";
3
- import fs from "node:fs/promises";
4
- import path from "node:path";
5
- import type { IncomingMessage, ServerResponse } from "node:http";
6
- import { defineConfig } from "vite";
7
- import react from "@vitejs/plugin-react";
8
- import { loadConfig, publicPdfHref } from "./engine/runtime/config.mjs";
9
- import { searchSourceText } from "./engine/runtime/source-text-tools.mjs";
10
- import { handleCommentRequest } from "./engine/react/comment-endpoint.mjs";
11
- import { handleProjectAssetRequest } from "./engine/react/project-asset-endpoint.mjs";
12
- import { handleSourceEditRequest } from "./engine/react/source-edit-endpoint.mjs";
13
-
14
- const frameworkRoot = fileURLToPath(new URL("./", import.meta.url));
15
- const workspaceRoot = process.env.OPENPRESS_WORKSPACE_ROOT
16
- ? path.resolve(process.env.OPENPRESS_WORKSPACE_ROOT)
17
- : frameworkRoot;
18
- const sourceRoot = path.join(frameworkRoot, "src");
19
- const openpressCliPath = path.join(frameworkRoot, "engine", "cli.mjs");
20
- const staticServerPath = path.join(frameworkRoot, "engine", "output", "static-server.mjs");
21
- const openpressCoreEntry = path.join(frameworkRoot, "src", "openpress", "core", "index.tsx");
22
- const openpressMdxEntry = path.join(frameworkRoot, "src", "openpress", "mdx", "index.ts");
23
- const openpressManuscriptEntry = path.join(frameworkRoot, "src", "openpress", "manuscript", "index.tsx");
24
- const openpressNumberingEntry = path.join(frameworkRoot, "src", "openpress", "numbering", "index.ts");
25
- const openpressConfig = await loadConfig(workspaceRoot);
26
- const outputDir = openpressConfig.paths.outputDir;
27
- const reactDocumentRoot = openpressConfig.paths.documentRoot;
28
- const reactDocumentComponentsRoot = openpressConfig.paths.componentsDir;
29
- const reactDocumentEntry = path.join(reactDocumentRoot, "index.tsx");
30
- const activeContentDir = await fileExists(reactDocumentEntry)
31
- ? path.join(reactDocumentRoot, "chapters")
32
- : openpressConfig.paths.sourceDir;
33
-
34
- // Workspace directories — Vite resolves these at build time so that
35
- // `import.meta.glob("@workspace/content/**")` and friends follow the active
36
- // OpenPress authoring source instead of a hardcoded `document/` prefix.
37
- const workspaceAliases = {
38
- "@workspace/content": activeContentDir,
39
- "@workspace/media": openpressConfig.paths.mediaDir,
40
- "@workspace/components": openpressConfig.paths.componentsDir,
41
- };
42
-
43
- // Relative paths displayed back to the user (e.g. "document/content/").
44
- // Resolved at build time so the React app does not hardcode `document/`.
45
- function relativeFromWorkspace(absolute: string) {
46
- const rel = path.relative(workspaceRoot, absolute).replaceAll("\\", "/");
47
- return rel.endsWith("/") ? rel : `${rel}`;
48
- }
49
- const workspaceDefines = {
50
- __OPENPRESS_CONTENT_PATH__: JSON.stringify(relativeFromWorkspace(activeContentDir)),
51
- __OPENPRESS_MEDIA_PATH__: JSON.stringify(relativeFromWorkspace(openpressConfig.paths.mediaDir)),
52
- __OPENPRESS_COMPONENTS_PATH__: JSON.stringify(relativeFromWorkspace(openpressConfig.paths.componentsDir)),
53
- __OPENPRESS_PDF_HREF__: JSON.stringify(publicPdfHref(openpressConfig)),
54
- };
55
-
56
- export default defineConfig({
57
- base: "./",
58
- cacheDir: path.join(workspaceRoot, ".openpress", "vite-client"),
59
- plugins: [openpressLocalDeployPlugin(), react()],
60
- define: workspaceDefines,
61
- resolve: {
62
- dedupe: ["react", "react-dom", "@mdx-js/react"],
63
- alias: {
64
- // Subpaths must come before the base path so resolution matches longest first.
65
- "@open-press/core/mdx": openpressMdxEntry,
66
- "@open-press/core/manuscript": openpressManuscriptEntry,
67
- "@open-press/core/numbering": openpressNumberingEntry,
68
- "@open-press/core": openpressCoreEntry,
69
- "@/components": reactDocumentComponentsRoot,
70
- "@": sourceRoot,
71
- ...workspaceAliases,
72
- },
73
- },
74
- optimizeDeps: {
75
- include: [
76
- "@mdx-js/react",
77
- "lucide-react",
78
- "react",
79
- "react-dom",
80
- "react-dom/client",
81
- "react/jsx-dev-runtime",
82
- "react/jsx-runtime",
83
- ],
84
- },
85
- build: {
86
- outDir: outputDir,
87
- emptyOutDir: true,
88
- rollupOptions: {
89
- output: {
90
- entryFileNames: "assets/[name]-[hash]-openpress.js",
91
- chunkFileNames: "assets/[name]-[hash]-openpress.js",
92
- assetFileNames: "assets/[name]-[hash]-openpress[extname]",
93
- },
94
- },
95
- },
96
- server: {
97
- host: "127.0.0.1",
98
- port: 5173,
99
- fs: {
100
- allow: Array.from(new Set([frameworkRoot, workspaceRoot])),
101
- },
102
- watch: {
103
- ignored: ["**/.openpress/tmp/**", `**/${openpressConfig.outputDir}/**`],
104
- },
105
- },
106
- preview: {
107
- host: "127.0.0.1",
108
- port: 5173,
109
- },
110
- });
111
-
112
- function openpressLocalDeployPlugin() {
113
- return {
114
- name: "openpress-local-deploy-endpoint",
115
- configureServer(server: { middlewares: { use: (path: string, handler: (req: IncomingMessage, res: ServerResponse) => void) => void } }) {
116
- server.middlewares.use("/__openpress/local-pdf-export", (req, res) => {
117
- void handleLocalPdfExportRequest(req, res);
118
- });
119
- server.middlewares.use("/__openpress/local-pdf-file", (req, res) => {
120
- void handleLocalPdfFileRequest(req, res);
121
- });
122
- server.middlewares.use("/__openpress/status", (req, res) => {
123
- void handleLocalStatusRequest(req, res);
124
- });
125
- server.middlewares.use("/__openpress/search", (req, res) => {
126
- void handleLocalSearchRequest(req, res);
127
- });
128
- server.middlewares.use("/__openpress/source-edit", (req, res) => {
129
- void handleSourceEditRequest(req, res, { root: workspaceRoot });
130
- });
131
- server.middlewares.use("/__openpress/deploy", (req, res) => {
132
- void handleLocalDeployRequest(req, res);
133
- });
134
- server.middlewares.use("/__openpress/comment", (req, res) => {
135
- void handleCommentRequest(req, res, { root: workspaceRoot });
136
- });
137
- server.middlewares.use("/__openpress/media-upload", (req, res) => {
138
- void handleLocalMediaUploadRequest(req, res);
139
- });
140
- server.middlewares.use("/__openpress/project-asset", (req, res) => {
141
- void handleProjectAssetRequest(req, res, { root: workspaceRoot });
142
- });
143
- server.middlewares.use("/openpress/media", (req, res) => {
144
- void handleLocalMediaFileRequest(req, res);
145
- });
146
- },
147
- };
148
- }
149
-
150
- async function handleLocalMediaUploadRequest(req: IncomingMessage, res: ServerResponse) {
151
- if (req.method !== "POST") {
152
- writeJson(res, 405, { ok: false, message: "Media upload endpoint requires POST." });
153
- return;
154
- }
155
-
156
- const rawFileName = headerValue(req.headers["x-openpress-file-name"]);
157
- const decodedFileName = rawFileName ? safeDecodeURIComponent(rawFileName) : "";
158
- const fileName = sanitizeMediaFileName(decodedFileName);
159
- if (!fileName) {
160
- writeJson(res, 400, { ok: false, message: "Media upload requires a valid file name." });
161
- return;
162
- }
163
- if (!isAllowedMediaFile(fileName)) {
164
- writeJson(res, 400, { ok: false, message: "Only png, jpg, jpeg, gif, svg, and webp files can be uploaded." });
165
- return;
166
- }
167
-
168
- try {
169
- const body = await readRequestBuffer(req, 30 * 1024 * 1024);
170
- if (body.length === 0) {
171
- writeJson(res, 400, { ok: false, message: "Uploaded media file is empty." });
172
- return;
173
- }
174
- await fs.mkdir(openpressConfig.paths.mediaDir, { recursive: true });
175
- const uniqueFileName = await uniqueMediaFileName(openpressConfig.paths.mediaDir, fileName);
176
- const targetPath = path.join(openpressConfig.paths.mediaDir, uniqueFileName);
177
- await fs.writeFile(targetPath, body);
178
- const relativePath = relativeFromWorkspace(targetPath);
179
- writeJson(res, 200, {
180
- ok: true,
181
- asset: {
182
- fileName: uniqueFileName,
183
- src: `/openpress/media/${encodeURIComponent(uniqueFileName)}`,
184
- path: relativePath,
185
- mention: `@media/${uniqueFileName}`,
186
- },
187
- });
188
- } catch (error) {
189
- writeJson(res, 500, { ok: false, message: error instanceof Error ? error.message : String(error) });
190
- }
191
- }
192
-
193
- async function handleLocalMediaFileRequest(req: IncomingMessage, res: ServerResponse) {
194
- if (req.method !== "GET" && req.method !== "HEAD") {
195
- writeJson(res, 405, { ok: false, message: "Media file endpoint requires GET." });
196
- return;
197
- }
198
-
199
- try {
200
- const requestUrl = new URL(req.url ?? "/", "http://localhost");
201
- const fileName = sanitizeMediaFileName(safeDecodeURIComponent(requestUrl.pathname.replace(/^\/openpress\/media\/?/, "").replace(/^\/+/, "")));
202
- if (!fileName) {
203
- writeJson(res, 404, { ok: false, message: "Media file not found." });
204
- return;
205
- }
206
- const targetPath = path.join(openpressConfig.paths.mediaDir, fileName);
207
- const resolvedTarget = path.resolve(targetPath);
208
- const mediaRoot = path.resolve(openpressConfig.paths.mediaDir);
209
- if (!resolvedTarget.startsWith(`${mediaRoot}${path.sep}`) && resolvedTarget !== mediaRoot) {
210
- writeJson(res, 403, { ok: false, message: "Forbidden." });
211
- return;
212
- }
213
- const body = await fs.readFile(resolvedTarget);
214
- res.writeHead(200, {
215
- "Content-Type": mediaMimeType(fileName),
216
- "Cache-Control": "no-store",
217
- });
218
- if (req.method === "HEAD") {
219
- res.end();
220
- } else {
221
- res.end(body);
222
- }
223
- } catch {
224
- writeJson(res, 404, { ok: false, message: "Media file not found." });
225
- }
226
- }
227
-
228
- async function handleLocalPdfExportRequest(req: IncomingMessage, res: ServerResponse) {
229
- if (req.method !== "POST") {
230
- writeJson(res, 405, { ok: false, message: "Local PDF export endpoint requires POST." });
231
- return;
232
- }
233
-
234
- const result = await runLocalPdfExport();
235
- const exists = await fileExists(openpressConfig.paths.pdf);
236
- writeJson(res, result.code === 0 && exists ? 200 : 500, {
237
- ok: result.code === 0 && exists,
238
- code: result.code,
239
- pdf: `/__openpress/local-pdf-file?ts=${Date.now()}`,
240
- command: openpressCliCommand(["pdf", "."]),
241
- stdout: result.stdout,
242
- stderr: result.stderr,
243
- });
244
- }
245
-
246
- async function handleLocalPdfFileRequest(req: IncomingMessage, res: ServerResponse) {
247
- if (req.method !== "GET") {
248
- writeJson(res, 405, { ok: false, message: "Local PDF file endpoint requires GET." });
249
- return;
250
- }
251
-
252
- try {
253
- const body = await fs.readFile(openpressConfig.paths.pdf);
254
- res.writeHead(200, {
255
- "Content-Type": "application/pdf",
256
- "Content-Disposition": `inline; filename="${openpressConfig.pdf.filename}"`,
257
- "Cache-Control": "no-store",
258
- });
259
- res.end(body);
260
- } catch {
261
- writeJson(res, 404, { ok: false, message: "Local PDF has not been generated yet." });
262
- }
263
- }
264
-
265
- async function handleLocalStatusRequest(req: IncomingMessage, res: ServerResponse) {
266
- if (req.method !== "GET") {
267
- writeJson(res, 405, { ok: false, message: "Status endpoint requires GET." });
268
- return;
269
- }
270
-
271
- const deployConfigured = isLocalDeployConfigured();
272
- const deploymentInfo = deployConfigured
273
- ? await readLocalDeploymentInfo()
274
- : { deployed_at: undefined, pdf: publicPdfHref(openpressConfig), public_url: undefined };
275
- const dirty = deployConfigured ? await isLocalDeploymentDirty(deploymentInfo.deployed_at) : false;
276
- writeJson(res, 200, {
277
- ok: true,
278
- deployed_at: deploymentInfo.deployed_at,
279
- pdf: deploymentInfo.pdf,
280
- public_url: deploymentInfo.public_url,
281
- dirty,
282
- deploy_configured: deployConfigured,
283
- deploy_adapter: openpressConfig.deploy.adapter,
284
- deploy_source: openpressConfig.deploy.source,
285
- deploy_project_name: openpressConfig.deploy.projectName,
286
- deploy_setup_message: localDeploySetupMessage(),
287
- });
288
- }
289
-
290
- async function handleLocalSearchRequest(req: IncomingMessage, res: ServerResponse) {
291
- if (req.method !== "GET") {
292
- writeJson(res, 405, { ok: false, message: "Search endpoint requires GET." });
293
- return;
294
- }
295
-
296
- const requestUrl = new URL(req.url ?? "/", "http://localhost");
297
- const query = (requestUrl.searchParams.get("q") ?? "").trim();
298
- if (!query) {
299
- writeJson(res, 400, { ok: false, message: "Search query is required." });
300
- return;
301
- }
302
-
303
- try {
304
- const report = await searchSourceText({
305
- config: openpressConfig,
306
- query,
307
- scope: searchScopeFrom(requestUrl.searchParams),
308
- caseSensitive: requestUrl.searchParams.get("caseSensitive") === "true",
309
- });
310
- writeJson(res, 200, { ok: true, ...report });
311
- } catch (error) {
312
- writeJson(res, 500, { ok: false, message: error instanceof Error ? error.message : String(error) });
313
- }
314
- }
315
-
316
- async function handleLocalDeployRequest(req: IncomingMessage, res: ServerResponse) {
317
- if (req.method !== "POST") {
318
- writeJson(res, 405, { ok: false, message: "Deploy endpoint requires POST." });
319
- return;
320
- }
321
-
322
- if (!isLocalDeployConfigured()) {
323
- writeJson(res, 400, {
324
- ok: false,
325
- code: 2,
326
- message: localDeploySetupMessage(),
327
- deploy_configured: false,
328
- deploy_adapter: openpressConfig.deploy.adapter,
329
- deploy_source: openpressConfig.deploy.source,
330
- deploy_project_name: openpressConfig.deploy.projectName,
331
- command: openpressCliCommand(["deploy", ".", "--confirm"]),
332
- });
333
- return;
334
- }
335
-
336
- const result = await runLocalDeploy();
337
- const deployedUrl = extractDeployUrl(result.stdout);
338
- if (result.code === 0 && deployedUrl) {
339
- await writeLocalDeploymentPublicUrl(deployedUrl);
340
- }
341
- const deploymentInfo = await readLocalDeploymentInfo();
342
- const publicUrl = deployedUrl ?? deploymentInfo.public_url;
343
- writeJson(res, result.code === 0 ? 200 : 500, {
344
- ok: result.code === 0,
345
- code: result.code,
346
- deployed_at: deploymentInfo.deployed_at,
347
- pdf: deployedUrl ? `${deployedUrl}/${openpressConfig.pdf.filename}` : deploymentInfo.pdf,
348
- public_url: publicUrl,
349
- dirty: false,
350
- command: openpressCliCommand(["deploy", ".", "--confirm"]),
351
- stdout: result.stdout,
352
- stderr: result.stderr,
353
- });
354
- }
355
-
356
- function runLocalPdfExport() {
357
- return new Promise<{ code: number; stdout: string; stderr: string }>((resolve) => {
358
- const child = spawn("node", [openpressCliPath, "pdf", "."], {
359
- cwd: workspaceRoot,
360
- shell: false,
361
- });
362
- let stdout = "";
363
- let stderr = "";
364
- child.stdout.on("data", (chunk) => {
365
- stdout += String(chunk);
366
- });
367
- child.stderr.on("data", (chunk) => {
368
- stderr += String(chunk);
369
- });
370
- child.on("error", (error) => {
371
- resolve({ code: 1, stdout, stderr: `${stderr}${error.message}\n` });
372
- });
373
- child.on("close", (code) => {
374
- resolve({ code: code ?? 1, stdout, stderr });
375
- });
376
- });
377
- }
378
-
379
- function runLocalDeploy() {
380
- return new Promise<{ code: number; stdout: string; stderr: string }>((resolve) => {
381
- const child = spawn("node", [openpressCliPath, "deploy", ".", "--confirm"], {
382
- cwd: workspaceRoot,
383
- shell: false,
384
- });
385
- let stdout = "";
386
- let stderr = "";
387
- child.stdout.on("data", (chunk) => {
388
- stdout += String(chunk);
389
- });
390
- child.stderr.on("data", (chunk) => {
391
- stderr += String(chunk);
392
- });
393
- child.on("error", (error) => {
394
- resolve({ code: 1, stdout, stderr: `${stderr}${error.message}\n` });
395
- });
396
- child.on("close", (code) => {
397
- resolve({ code: code ?? 1, stdout, stderr });
398
- });
399
- });
400
- }
401
-
402
- function isLocalDeployConfigured() {
403
- if (openpressConfig.deploy.adapter === "cloudflare-pages") {
404
- return typeof openpressConfig.deploy.projectName === "string" && openpressConfig.deploy.projectName.trim().length > 0;
405
- }
406
- return true;
407
- }
408
-
409
- function localDeploySetupMessage() {
410
- if (isLocalDeployConfigured()) return undefined;
411
- if (openpressConfig.deploy.adapter === "cloudflare-pages") {
412
- return "Cloudflare Pages deployment requires `deploy.projectName` in openpress.config.mjs.";
413
- }
414
- return `Deployment adapter \`${openpressConfig.deploy.adapter}\` is not configured.`;
415
- }
416
-
417
- function searchScopeFrom(searchParams: URLSearchParams) {
418
- return searchParams.get("scope") === "all" ? "all" : "content";
419
- }
420
-
421
- async function fileExists(filePath: string) {
422
- try {
423
- await fs.access(filePath);
424
- return true;
425
- } catch {
426
- return false;
427
- }
428
- }
429
-
430
- async function readLocalDeploymentInfo() {
431
- try {
432
- const text = await fs.readFile(openpressConfig.paths.deployMetadata, "utf8");
433
- const deployConfig = JSON.parse(text) as { deployed_at?: unknown; pdf?: unknown; public_url?: unknown };
434
- return {
435
- deployed_at: typeof deployConfig.deployed_at === "string" ? deployConfig.deployed_at : undefined,
436
- pdf: typeof deployConfig.pdf === "string" ? deployConfig.pdf : publicPdfHref(openpressConfig),
437
- public_url: typeof deployConfig.public_url === "string" ? deployConfig.public_url : undefined,
438
- };
439
- } catch {
440
- return { deployed_at: undefined, pdf: publicPdfHref(openpressConfig), public_url: undefined };
441
- }
442
- }
443
-
444
- async function writeLocalDeploymentPublicUrl(publicUrl: string) {
445
- let deployConfig: Record<string, unknown> = {};
446
- try {
447
- deployConfig = JSON.parse(await fs.readFile(openpressConfig.paths.deployMetadata, "utf8")) as Record<string, unknown>;
448
- } catch {
449
- deployConfig = {};
450
- }
451
- await fs.mkdir(path.dirname(openpressConfig.paths.deployMetadata), { recursive: true });
452
- await fs.writeFile(
453
- openpressConfig.paths.deployMetadata,
454
- `${JSON.stringify({ ...deployConfig, pdf: `${publicUrl}/${openpressConfig.pdf.filename}`, public_url: publicUrl }, null, 2)}\n`,
455
- "utf8",
456
- );
457
- }
458
-
459
- async function isLocalDeploymentDirty(deployedAt: string | undefined) {
460
- if (!deployedAt) return false;
461
- const deployedTime = new Date(deployedAt).getTime();
462
- if (Number.isNaN(deployedTime)) return false;
463
- const newestSourceMtime = await findNewestLocalSourceMtime(getLocalDeploymentSourcePaths());
464
- return newestSourceMtime > deployedTime + 1000;
465
- }
466
-
467
- function getLocalDeploymentSourcePaths() {
468
- return [
469
- openpressConfig.paths.sourceDir,
470
- openpressConfig.paths.mediaDir,
471
- openpressConfig.paths.themeDir,
472
- openpressConfig.paths.designDoc,
473
- openpressConfig.paths.componentsDir,
474
- path.join(frameworkRoot, "src"),
475
- path.join(workspaceRoot, "index.html"),
476
- path.join(workspaceRoot, "package.json"),
477
- path.join(workspaceRoot, "openpress.config.mjs"),
478
- openpressConfig.configPath,
479
- path.join(workspaceRoot, "vite.config.ts"),
480
- ];
481
- }
482
-
483
- function openpressCliCommand(args: string[]) {
484
- const relativeCliPath = path.relative(workspaceRoot, openpressCliPath).replaceAll("\\", "/");
485
- const displayCliPath = relativeCliPath && !relativeCliPath.startsWith("../") ? relativeCliPath : openpressCliPath;
486
- return `node ${displayCliPath} ${args.join(" ")}`;
487
- }
488
-
489
- async function findNewestLocalSourceMtime(paths: string[]) {
490
- const times = await Promise.all(paths.map((sourcePath) => findNewestLocalMtime(sourcePath)));
491
- return Math.max(0, ...times);
492
- }
493
-
494
- async function findNewestLocalMtime(sourcePath: string): Promise<number> {
495
- try {
496
- const stat = await fs.stat(sourcePath);
497
- if (!stat.isDirectory()) return stat.mtimeMs;
498
- const entries = await fs.readdir(sourcePath, { withFileTypes: true });
499
- const times = await Promise.all(entries.map((entry) => findNewestLocalMtime(path.join(sourcePath, entry.name))));
500
- return Math.max(stat.mtimeMs, ...times);
501
- } catch {
502
- return 0;
503
- }
504
- }
505
-
506
- function headerValue(value: string | string[] | undefined) {
507
- return Array.isArray(value) ? value[0] : value;
508
- }
509
-
510
- function safeDecodeURIComponent(value: string) {
511
- try {
512
- return decodeURIComponent(value);
513
- } catch {
514
- return value;
515
- }
516
- }
517
-
518
- function sanitizeMediaFileName(value: string) {
519
- const baseName = path.basename(value).trim();
520
- if (!baseName) return "";
521
- const ext = path.extname(baseName);
522
- const stem = path.basename(baseName, ext)
523
- .replace(/[\\/:*?"<>|#%{}^~[\]`]/g, "-")
524
- .replace(/\s+/g, "-")
525
- .replace(/-+/g, "-")
526
- .replace(/^-|-$/g, "");
527
- if (!stem || !ext) return "";
528
- return `${stem}${ext.toLowerCase()}`;
529
- }
530
-
531
- function isAllowedMediaFile(fileName: string) {
532
- return /\.(png|jpe?g|gif|svg|webp)$/i.test(fileName);
533
- }
534
-
535
- function mediaMimeType(fileName: string) {
536
- const ext = path.extname(fileName).toLowerCase();
537
- if (ext === ".png") return "image/png";
538
- if (ext === ".jpg" || ext === ".jpeg") return "image/jpeg";
539
- if (ext === ".gif") return "image/gif";
540
- if (ext === ".svg") return "image/svg+xml";
541
- if (ext === ".webp") return "image/webp";
542
- return "application/octet-stream";
543
- }
544
-
545
- async function uniqueMediaFileName(mediaDir: string, fileName: string) {
546
- const ext = path.extname(fileName);
547
- const stem = path.basename(fileName, ext);
548
- let candidate = fileName;
549
- let counter = 2;
550
- while (await fileExists(path.join(mediaDir, candidate))) {
551
- candidate = `${stem}-${counter}${ext}`;
552
- counter += 1;
553
- }
554
- return candidate;
555
- }
556
-
557
- function readRequestBuffer(req: IncomingMessage, maxBytes: number) {
558
- return new Promise<Buffer>((resolve, reject) => {
559
- const chunks: Buffer[] = [];
560
- let total = 0;
561
- req.on("data", (chunk: Buffer | string) => {
562
- const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
563
- total += buffer.length;
564
- if (total > maxBytes) {
565
- reject(new Error("Uploaded media file is too large."));
566
- req.destroy();
567
- return;
568
- }
569
- chunks.push(buffer);
570
- });
571
- req.on("end", () => resolve(Buffer.concat(chunks)));
572
- req.on("error", reject);
573
- });
574
- }
575
-
576
- function writeJson(res: ServerResponse, status: number, body: unknown) {
577
- res.writeHead(status, { "Content-Type": "application/json; charset=utf-8" });
578
- res.end(`${JSON.stringify(body, null, 2)}\n`);
579
- }
580
-
581
- function extractDeployUrl(output: string) {
582
- const match = output.match(/https:\/\/[^\s]+\.pages\.dev/);
583
- return match?.[0]?.replace(/\/$/, "");
584
- }
@@ -1,35 +0,0 @@
1
- ## Introduction
2
-
3
- The purpose of this paper template is to provide a compact, readable structure for a
4
- machine-learning research manuscript written in a formal journal style.
5
-
6
- ### Background and Motivation
7
-
8
- Recent studies have shown that modern experiments produce larger datasets and richer
9
- artifact pipelines, but the writing process is often bottlenecked by repeated formatting
10
- adjustments. A lightweight drafting layer can decouple scientific reasoning from
11
- typesetting concerns and let the author focus on experimental validity first.
12
-
13
- ### Problem Statement
14
-
15
- The key challenge addressed in this draft is to keep the manuscript internally
16
- consistent while moving from scratch notes to a submission-ready narrative. The
17
- workflow should preserve section hierarchy, citation order, and figure/table integrity
18
- without requiring manual renumbering.
19
-
20
- ### Contribution
21
-
22
- This demo paper includes the following contributions:
23
-
24
- - A reproducible chapter flow (`Introduction → Methods → Results and Discussion →
25
- Conclusion`),
26
- - Consistent heading levels for major and minor sections,
27
- - Placeholder media and tables that can be swapped with real results,
28
- - A reference block and placeholder metadata for a clean handoff to final publication
29
- tooling.
30
-
31
- ### Paper Organization
32
-
33
- The paper is organized as follows: Section 2 details the methodology,
34
- Section 3 reports results and discusses representative scenarios,
35
- Section 4 summarizes conclusions and practical recommendations.