@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
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@open-press/cli",
3
- "version": "0.8.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
- "description": "Scaffolder for open-press AI-first fixed-layout document workspaces.",
5
+ "description": "Command line interface for OpenPress workspaces.",
6
6
  "license": "MIT",
7
7
  "author": "quan0715",
8
8
  "homepage": "https://github.com/quan0715/open-press#readme",
@@ -24,14 +24,15 @@
24
24
  "ai-first",
25
25
  "scaffold",
26
26
  "init",
27
- "cli"
27
+ "cli",
28
+ "render",
29
+ "pdf"
28
30
  ],
29
31
  "bin": {
30
32
  "open-press": "dist/cli.js"
31
33
  },
32
34
  "files": [
33
35
  "dist",
34
- "template",
35
36
  "README.md"
36
37
  ],
37
38
  "publishConfig": {
@@ -41,7 +42,7 @@
41
42
  "node": ">=20"
42
43
  },
43
44
  "dependencies": {
44
- "tar": "^7.5.0"
45
+ "@open-press/core": "1.1.0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/node": "^25.8.0",
@@ -49,9 +50,9 @@
49
50
  "typescript": "^6.0.3"
50
51
  },
51
52
  "scripts": {
52
- "sync:template": "node scripts/sync-template.mjs",
53
- "build": "pnpm sync:template && tsup",
53
+ "build": "tsup",
54
54
  "dev": "tsup --watch",
55
- "typecheck": "tsc --noEmit"
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "pnpm build && node --test tests/*.test.mjs"
56
57
  }
57
58
  }
@@ -1,126 +0,0 @@
1
- # Working on this open-press workspace
2
-
3
- This directory is an **open-press workspace** scaffolded by
4
- `@open-press/cli`. You (the agent) own:
5
-
6
- - `document/` — chapters (MDX), components, theme, media. The actual content.
7
- - `package.json` / `openpress.config.mjs` — project metadata + build config.
8
- - `.agents/skills/` — agent skills installed by `npx skills` (auto-refreshed via `npx open-press upgrade`).
9
-
10
- The rest of the tree is the open-press framework copied at scaffold time
11
- (`engine/`, `src/`, `vite.config.ts`, etc). Treat it as vendored — don't
12
- hand-edit unless the user explicitly asks; the next `npx open-press upgrade`
13
- will rewrite it.
14
-
15
- ## Quick reference
16
-
17
- ```bash
18
- npm run dev # workbench at http://127.0.0.1:5173/?dev=1
19
- npm run openpress:validate # structural checks
20
- npm run openpress:render # full render through chromium
21
- npm run openpress:pdf # write document.pdf
22
- npm run openpress:export # write public/openpress/document.json
23
- npm run openpress:deploy # deploy via the configured adapter
24
- npx open-press doctor # current vs latest version + pending migrations
25
- npx open-press upgrade # apply the upgrade flow (see below)
26
- ```
27
-
28
- ## When the user asks to upgrade
29
-
30
- Triggers: "升級 / 套件更新 / upgrade open-press / apply latest design /
31
- update to vX.Y.Z" etc.
32
-
33
- **Follow the upgrade SOP, do NOT manually diff template versions:**
34
-
35
- 1. `npx open-press doctor` — confirm current vs latest, count pending
36
- migrations.
37
- 2. Ask the user "go ahead?" — briefly mention what will change (deps,
38
- skills, migrations to read).
39
- 3. `npx open-press upgrade` — refreshes `@open-press/core`, refreshes
40
- installed skills, **fetches migration notes for each pending version
41
- into `.openpress/migrations/<version>.md`** and lists the paths.
42
- 4. For each migration file listed, read it fully. Each has a
43
- `Document-level changes` section with `rg` find + rewrite rules.
44
- Apply to `document/` with user confirmation.
45
- 5. Verify:
46
- ```bash
47
- npm run openpress:validate
48
- npm run openpress:render
49
- ```
50
- Fix anything broken using the migration notes.
51
- 6. Report to the user: starting version → ending version, what was
52
- applied, anything that needed manual judgement.
53
-
54
- **Anti-pattern**: running `npx @open-press/cli@latest init` somewhere
55
- and manually diffing against the workspace. The migration notes are the
56
- authoritative source for what changed; fresh templates ship default
57
- content that does not apply to a customised workspace.
58
-
59
- ## When the user says "I changed X but the page didn't update"
60
-
61
- Common cause: **the reader renders from a static `public/openpress/document.json`,
62
- not from your live MDX / theme files.** Vite Hot Reload covers React UI
63
- chrome (workbench panels, inspector, navigation) but it does **not**
64
- regenerate `document.json`. So edits to:
65
-
66
- - `document/chapters/**/*.mdx` (prose)
67
- - `document/index.tsx` (Press tree, Cover/BackCover JSX)
68
- - `document/components/**/*.tsx` (Page, openers, custom components)
69
- - `document/theme/**` style files that affect pagination capacity
70
- - `openpress.config.mjs` metadata (title, captionNumbering, …)
71
-
72
- …all need a re-export before the workbench / public viewer reflect
73
- the change:
74
-
75
- ```bash
76
- npm run openpress:export # regenerate public/openpress/document.json
77
- # then refresh the browser
78
- ```
79
-
80
- Quick rules of thumb:
81
-
82
- - Pure CSS edits under `document/theme/` that don't move blocks → HMR
83
- is enough (CSS is hot-replaced).
84
- - Anything that affects content, pagination, or metadata → re-export.
85
- - `npm run openpress:render` is `export` + extra asset sync; either
86
- works to refresh the JSON.
87
-
88
- **Agent SOP**: after applying any non-CSS edit to `document/`, run
89
- `npm run openpress:export` before telling the user "done". If they ask
90
- "why didn't my change show up?", check whether `document.json` was
91
- regenerated since the edit.
92
-
93
- ## When the user reports a render / paginate issue
94
-
95
- Press Tree paginates at build time. Common things to check:
96
-
97
- 1. `npm run openpress:export` then inspect
98
- `public/openpress/document.json` for `source.warnings` (chain
99
- overflow, missing chains, etc.).
100
- 2. `npm run openpress:validate` for structural issues
101
- (missing entries, broken anchors).
102
- 3. `npm run dev` and use the workbench inspector to find which MDX
103
- block / Frame element is misbehaving — comments and inline
104
- annotations work directly from there.
105
-
106
- ## Skills
107
-
108
- This workspace ships agent skills under `.agents/skills/`. If your
109
- platform supports skills (Claude Code, Cursor, Codex, Cline, Gemini
110
- CLI, …), prefer invoking them over re-reading this file:
111
-
112
- - `openpress` — operate the workspace (CLI, validate, export, render,
113
- PDF, deploy, search/replace, comments, upgrades, routing).
114
- - `openpress-writing` — writing-time rules for MDX prose.
115
- - `openpress-design` — theme tokens, layout, page surfaces.
116
- - `openpress-deploy` — deployment workflows.
117
- - `openpress-init` — scaffolding new workspaces.
118
- - Plus any style-pack-specific skills installed by the user.
119
-
120
- Skills are kept in sync by `npx skills upgrade` (run automatically
121
- inside `npx open-press upgrade`).
122
-
123
- ## Reporting issues
124
-
125
- - Issues / questions: https://github.com/quan0715/open-press/issues
126
- - Source: https://github.com/quan0715/open-press
@@ -1,215 +0,0 @@
1
- # @open-press/core
2
-
3
- ## 0.8.0
4
-
5
- ### Minor Changes
6
-
7
- - **Workbench architecture**: the monolithic `workbench.tsx` is split into a modular structure under `workbench/{shell,panels,actions,inspector,mentions,project,document}/`. New panels: `DeploymentControl`, `SearchControl`, `PendingCommentsPanel`, `DocumentPanel`, `ProjectEntryPanel`, plus `WorkbenchShell` and `InlineInspectorLayer`.
8
- - **Module reorganization**: source tree split into typed subdirectories:
9
- - `app/`: `OpenPressApp`, `OpenPressRuntime` (replaces the old `App.tsx` + `renderer.tsx`)
10
- - `document-model/`: `anchorMap`, `documentIndexes`, `documentTypes`, `objectEntityModel`, `projectIdentity`, `reactDocumentMetadata`
11
- - `reader/`: `PublicReaderPage`, `ReaderNavigationPanel`, `useReaderRuntime`, registry/route/scroll/state helpers
12
- - `shared/`: `frameScheduler`, `runtimeMode`, `Panel`, `numberUtils`
13
- - **Object-entity model**: `Frame` and `MdxArea` now expose `data-openpress-object-id`. New `document-model/objectEntityModel` defines the id format.
14
- - **`MediaFigure` / `ImageFigure`**: new core primitives that accept `src/alt/caption` and resolve relative paths to `/openpress/media/...` automatically.
15
- - **`<Sections>` default page**: `page` prop becomes optional; when omitted the built-in `DefaultSectionPage` renders the standard manuscript frame.
16
- - **Engine helpers**: new `engine/react/{http-json,object-entities,source-edit-endpoint}.mjs` and `engine/runtime/{file-walk,path-utils}.mjs` runtime helpers. `engine/runtime/source-text-tools` exports TypeScript definitions.
17
- - **Dev endpoints**: vite plugin wires `/__openpress/search` and `/__openpress/source-edit` middlewares for the new workbench search + inline editing flows.
18
- - **Inline source editor**: ships the `InlineSourceEditorLayer` UI on top of `useInlineDocumentEditor` + `/__openpress/source-edit`. The hook now uses a `MutationObserver` so newly inserted blocks become editable, and routes mouse clicks through `focus()` to preserve selection on `contenteditable` boundaries. Workbench wires `sourceEditorTarget` state into the layer.
19
- - **Table editing in the source pipeline**: table captions are emitted as standalone source blocks (`kind=element`, `name=caption`, `layout="attached"`) with `data-openpress-block-id`/`data-openpress-object-id` markers and preserved source positions; the allocator treats `layout="attached"` blocks as non-paginable. `applySourceBlockTableCellEditToText` (in `engine/runtime/source-text-tools`) accepts a `cellIndex` so the inline source editor can target a single `<td>`.
20
- - **Reader pagination**: arrow-key pagination now defers to the user's active text selection. Shift-arrow / mouse-drag selections no longer get swallowed by the page-turn shortcut.
21
- - **Page zoom + spread layout**: new `reader/pageViewportScaleModel` + `usePageViewportScale` hook drive a `--openpress-page-viewport-scale` CSS variable on the page container; the workbench toolbar exposes a `PageZoomControl` dropdown with fit-width / fit-page / fixed percentages plus a one-page / two-page spread toggle.
22
- - **Inspector cell-precision comments**: `CommentDraft` gains an optional `targetObjectId` so a comment can point at a sub-block (e.g. a single table cell) while still attributing the source position to its enclosing block. `formatInspectorHint` carries the value through to the wire hint.
23
- - **Shared `WorkbenchDialog` shell**: portal + backdrop + header (eyebrow / title / title-meta / close) + optional footer. `DeploymentControl`, `SearchControl`, and `ProjectPreviewDialog` all render through this shell now, replacing the prior per-dialog scaffolding under `openpress-deploy-dialog-*` / `openpress-search-dialog-*` / `openpress-project-preview-dialog__*`.
24
- - **`WorkbenchControlPanel` registry**: `HtmlWorkbench` now accepts an `extraControlPanels?: WorkbenchPanel[]` prop and renders the right-side panel from a `{ id, render }` registry. Built-in panels (pending comments, project entry) ship as the first entries.
25
- - **Workbench state hooks**: extract `useDeploymentWorkbench` and `useInspectorComments` from `HtmlWorkbench`; `useReaderRuntime` is split into focused sub-hooks (`usePanelState`, `useReaderScrollAnchor`, `useReaderHashSync`, `useReaderKeyboardNav`).
26
- - **`InlineInspectorLayer` memoization**: now wrapped in `React.memo` with a stable `geometryVersion` prop so the geometry / event listeners no longer rebuild on every parent render.
27
- - **Panels open lazily**: `usePanelState` now defaults both panels closed, so the reader opens with a clean stage; resize never auto-opens them.
28
-
29
- ### Patch Changes
30
-
31
- - Inspector: fix comment-marker count and multi-target marker rendering.
32
- - Inspector: object-entity id helpers consolidate in `document-model/objectEntityModel` instead of being duplicated inside `Frame`, `MdxArea`, manuscript `TocArea`, and `PublicReaderPage`.
33
- - Inline editor: `useInlineDocumentEditor` exposes `onDocumentEdited`; `OpenPressApp` re-loads `/openpress/document.json` after a successful inline edit so derived indexes stay in sync.
34
- - Dev: reset Vite optimizer cache so workspace-side dependencies are picked up.
35
- - Workbench dialog: viewport-aware width + max-height so a big media preview doesn't blow up the dialog to full screen.
36
- - Project composer: add `/apply-comments` to the skill mention list so pending comment resolution can be invoked from the workbench.
37
- - Carries forward the 0.7.1 measurement + pagination fixes (font/image readiness, relative media src inlining, list-per-item paging, `OPENPRESS_DEBUG_ALLOC`, academic-paper starter body overflow).
38
-
39
- ### Breaking Changes
40
-
41
- - `FrameContext.consumeArea(chainId)` return type changes from `ReactNode | null` to `{ indexInFrame: number; blocks: ReactNode | null }`. Custom `Frame` consumers must read `.blocks`.
42
- - `App` export is renamed to `OpenPressApp` and now lives under `@open-press/core/app`. The old `renderer.tsx` is replaced by `OpenPressRuntime`.
43
- - `data-openpress-mdx-area-empty` is now always emitted (`"true"` / `"false"`). Selectors that relied on the attribute being absent need updating.
44
- - Reader `ViewMode` collapses to `"paged"` only — the legacy `"reading"` flow mode is removed. Use `usePageViewportScale` for free-scaling instead.
45
- - Several internal module paths moved into subdirectories (`document-model/`, `reader/`, `shared/`, `workbench/...`). Consumers that deep-imported from the openpress source must switch to the new barrels.
46
- - Shared dialog scaffolding (backdrop, container, header, close button) moved from per-dialog class families (`openpress-deploy-dialog-backdrop`, `__panel`, `__panel header`, `__close`, etc.) to the shared `openpress-workbench-dialog*` family. Per-dialog modifier classes (`openpress-deploy-dialog`, `openpress-search-dialog`, `openpress-project-preview-dialog`) are still applied for dialog-specific styling. Selectors that targeted the old scaffolding names (notably `*-backdrop` and `__panel`) need updating; selectors that combine the modifier class with new `__heading` / `__footer` / `__close` modifiers continue to work.
47
-
48
- ## 0.7.1
49
-
50
- ### Patch Changes
51
-
52
- - Measurement pipeline + pagination fixes:
53
-
54
- - **Measurement**: wait on `document.fonts.ready`, image `load`/`error` + `decode()`,
55
- and two `requestAnimationFrame` ticks before sampling block heights so figures
56
- no longer under-measure on cold loads.
57
- - **Measurement**: inline relative `media/`, `./media/`, and `/openpress/media/`
58
- image sources during the SSR measurement pass (previously only the absolute
59
- `/openpress/media/...` form was rewritten, leaving relative refs as broken).
60
- - **MDX compile**: split bullet/numbered lists into per-item paginable blocks
61
- so long lists can break across pages without losing ordered numbering.
62
- - **Debug**: new `OPENPRESS_DEBUG_ALLOC` env var prints per-iteration allocator
63
- state (mdxArea capacities, block heights, pagination hints, warnings).
64
- - **Academic-paper starter**: `<MdxArea overflow="extend">` on the body and the
65
- single-column `.reader-page--content .page-body` override removed so content
66
- paginates naturally with the new allocator.
67
-
68
- ## 0.7.0
69
-
70
- ### Minor Changes
71
-
72
- - 718d2d1: **Press Tree render architecture** — full refresh of the React export pipeline (clean break, no v0.5 compatibility).
73
-
74
- The render kernel no longer knows about `cover`, `toc`, `chapter`, or `back-cover` as built-in concepts. Workspaces describe their document as a React tree using three primitives:
75
-
76
- - `Press` — root composition boundary.
77
- - `Frame` — a single fixed-layout surface (replaces `BasePage` and friends).
78
- - `MdxArea` — a measurable slot consuming a content chain, with `overflow="extend|truncate|error"` control.
79
-
80
- Sources are now declarative descriptors:
81
-
82
- ```tsx
83
- export const sources = {
84
- story: mdxSource({ preset: "section-folders", root: "chapters" }),
85
- };
86
-
87
- export default function MyPress() {
88
- return (
89
- <Press>
90
- <Cover />
91
- <Toc source="story" />
92
- <Sections source="story" page={Page} />
93
- <BackCover />
94
- </Press>
95
- );
96
- }
97
- ```
98
-
99
- Three `mdxSource()` presets: `section-folders` (existing convention), `section-files` (flat file-per-section), `file-list` (explicit ordering).
100
-
101
- Manuscript helpers (`Toc`, `Sections`, `Chapters` alias) ship in `@open-press/core/manuscript`. `mdxSource()` lives in `@open-press/core/mdx`. Subpath exports keep the public surface tight without committing to separate npm packages.
102
-
103
- `Toc` is implemented as a manuscript helper, not a core kernel special case. Registered sources generate a synthetic `toc:<sourceId>` chain; `TocArea` consumes it with the same allocation path as `MdxArea`.
104
-
105
- Reader-side pagination is removed. The export pipeline writes final frame HTML into `document.json`; the reader displays that HTML and no longer mutates headings/captions, injects footers, or reflows pages at runtime. Page shell belongs to workspace components.
106
-
107
- MDX source resolution now derives manuscript TOC entries from actual `##` / `###` headings, not folder slugs. Heading numbering is written during export as `data-chapter="01"` / `data-section="1.1"` attributes so themes can render numbering with CSS without reader-side mutation.
108
-
109
- **Removed (no compatibility layer):**
110
-
111
- - `BasePage`, `BaseCoverPage`, `BaseTocPage`, `BaseContentPage`, `BaseBackCoverPage`.
112
- - Legacy named exports (`cover`, `toc`, `backCover`) from `document/index.tsx`.
113
- - The `migrate-to-react` CLI command.
114
- - Implicit chapter discovery as the only source mechanism.
115
- - Legacy `chapter.tsx` meta/opener auto-discovery. Section openers are explicit workspace components in the Press tree.
116
-
117
- The top-level purity gate remains: `config` must be data, `sources` must be pure `mdxSource()` descriptors, and filesystem/network/process side effects are rejected before module execution. Default-exported function bodies can contain normal React component logic, including hooks and `.map()`.
118
-
119
- All `<Frame>` instances require a stable `frameKey`; source roots and file-list entries must stay inside `document/`.
120
-
121
- **Workspace data attributes:**
122
-
123
- - `data-frame-role` (new, opaque role like `"manuscript.content"`).
124
- - `data-page-kind` (derived from role's last segment — reader CSS keeps using this).
125
- - `data-section-id` replaces `data-chapter-slug` for section-scoped CSS.
126
-
127
- **Migration:** Workspaces written for v0.5.x must rewrite `document/index.tsx` to default-export a Press component. Pre-1.0 minor bump is acceptable per repo policy; no production deployments exist to break.
128
-
129
- See `docs/superpowers/specs/2026-05-23-press-tree-render-architecture-design.md` for full design rationale.
130
-
131
- ## 0.6.0
132
-
133
- ### Minor Changes
134
-
135
- - f8fdecd: Third bundled pack: `academic-paper`.
136
-
137
- A single-column A4 academic / research paper starter — serif title block, abstract band, index terms, numbered sections (I, II, III), italic sub-sections (A, B, C), `[N]` numeric references, sample chapters derived from the IEEE conference template structure (Introduction, Methods, Results & Discussion, Acknowledgment, References).
138
-
139
- ```bash
140
- npx @open-press/cli init my-paper --pack academic-paper
141
- ```
142
-
143
- Suitable for: draft / preprint / iteration. Not suitable for camera-ready IEEE / ACM submission — those still need LaTeX with the publisher's class file.
144
-
145
- Two-column body and other paged-document features (footnotes, cross-references with page numbers, running headers) are intentionally **out of scope for this release**. They'll be designed as a self-maintained engine evolution + multi-mode architecture in a separate spec round, rather than depending on a third-party pagination polyfill.
146
-
147
- - c490653: `@open-press/cli init` accepts third-party style packs via `--pack github:owner/repo`.
148
-
149
- ```bash
150
- # bundled (unchanged)
151
- npx @open-press/cli init my-doc --pack editorial-monograph
152
-
153
- # third-party (new)
154
- npx @open-press/cli init my-thesis --pack github:quan0715/openpress-pack-nycu-thesis
155
- npx @open-press/cli init my-paper --pack github:foo/their-pack#v1.2
156
- ```
157
-
158
- The cli fetches `starter/document/` from the named repo (default branch, or `#ref` for a specific branch/tag) and copies it into the new workspace. If the pack repo also publishes SKILL files at `skills/<name>/`, they're installed via `npx skills add <owner>/<repo>` after the framework skills, so the agent picks them up automatically.
159
-
160
- Repo layout convention for third-party packs is documented in `docs/style-pack-authoring.md`. Empty-result extraction (the named repo exists but has no `starter/document/` at root) fails with a clear error pointing at the expected layout.
161
-
162
- The two bundled packs (`editorial-monograph`, `claude-document`) keep their current short-name behaviour; only the cli's validator widened to accept the `github:` prefix.
163
-
164
- ## 0.5.0
165
-
166
- ### Minor Changes
167
-
168
- - 0169cba: Agent-driven upgrade flow.
169
-
170
- **New commands:**
171
-
172
- - `npx open-press doctor` — diagnose workspace against latest framework state. Reports `@open-press/core` version vs npm latest, installed skill count, and any pending `docs/migrations/<version>.md` notes between current and latest. `--json` for machine-readable output, `--no-cache` to bypass the 24h cache. Always exits 0 (informational only).
173
-
174
- - `npx open-press upgrade` — orchestrate the upgrade. Runs `npm update @open-press/core` (when the workspace declares the dep) and `npx skills upgrade`, then surfaces the list of migration notes for the agent to read. **Does not auto-edit `document/` content** — the agent reads the surfaced `docs/migrations/<version>.md` notes and proposes edits to the user with confirmation. Use `--dry-run` to preview, `--no-deps` / `--no-skills` to target one layer.
175
-
176
- **Dev startup notice:**
177
-
178
- `open-press dev` now runs `doctor` before starting Vite. When the workspace is behind, a single line prints: `○ open-press: @open-press/core 0.4.0 → 0.5.0 · 1 migration note(s) — run npx open-press doctor for details.` Cached for 24h, network failure is silent, never blocks dev.
179
-
180
- **Migration docs:**
181
-
182
- - New `docs/migrations/_template.md` — each release with breaking changes ships a `docs/migrations/<version>.md` file with sections the agent reads.
183
- - New `docs/migrations/0.4.0.md` — backfilled. Documents the SKILL fold (no document or CLI changes).
184
-
185
- **SKILL update:**
186
-
187
- `openpress` skill's "Updating An Existing Workspace" section rewritten around the new commands: detect (`doctor`), apply (`upgrade`), interpret migration notes, propose document edits with user confirmation. Concrete agent workflow + breaking-change reference table.
188
-
189
- ### Patch Changes
190
-
191
- - 931d4ac: Support framework root dogfood workspaces and correct CLI script paths outside the core package root.
192
-
193
- ## 0.4.0
194
-
195
- ### Minor Changes
196
-
197
- - 3cb4939: Consolidate internal skills (13 → 11).
198
-
199
- - `openpress-update` folded into `openpress` as an "Updating An Existing Workspace" section. The release-upgrade flow, pre-flight checks, breaking-change reference, and do-not list are now part of the system-operation skill where they naturally belong.
200
- - `openpress-document-hierarchy` folded into `openpress-writing` as a "Hierarchy" section. Hierarchy decisions (H2/H3/H4 model, TOC depth, appendix placement, H4 granularity) and prose decisions happen in the same workflow; one skill, one routing decision.
201
- - `references/data-structures-outline.md` moved from the hierarchy skill into `openpress-writing/references/`.
202
-
203
- Lower maintenance surface: 2 fewer SKILL.md files to keep in sync, ~5 fewer cross-references to police. No content lost — same rules, fewer files.
204
-
205
- User impact: agents already in workspaces with `openpress-update` or `openpress-document-hierarchy` SKILL files installed should run `npx skills upgrade` to refresh the catalog.
206
-
207
- ## 0.3.0
208
-
209
- ### Minor Changes
210
-
211
- - Initial monorepo release of `@open-press/cli` and `@open-press/core` on npm.
212
-
213
- **@open-press/cli** (new): scaffolder for open-press workspaces. Run `npx @open-press/cli init <target> --pack <pack>` to create a fixed-layout document workspace from a bundled template. Supports `editorial-monograph` and `claude-document` style packs, metadata flags, and AI-agent skill installation under `.claude/skills/` and `.agents/skills/`.
214
-
215
- **@open-press/core** (new): framework runtime, CLI engine, render pipeline, and document primitives. Consumed transitively by workspaces scaffolded via `@open-press/cli`. Exposes the `open-press` bin (dev / build / preview / validate / pdf / deploy / export).
@@ -1,40 +0,0 @@
1
- # @open-press/core
2
-
3
- Framework runtime, CLI engine, and Press Tree primitives for [open-press](https://github.com/quan0715/open-press) — an AI-first fixed-layout document workspace.
4
-
5
- Most users do **not** install this package directly. Instead, scaffold a workspace with the CLI:
6
-
7
- ```bash
8
- npx @open-press/cli init my-doc --pack editorial-monograph
9
- ```
10
-
11
- The scaffolded workspace contains a snapshot of this package.
12
-
13
- ## Direct use
14
-
15
- If you want the runtime primitives in an existing project:
16
-
17
- ```bash
18
- npm install @open-press/core
19
- ```
20
-
21
- ```tsx
22
- import {
23
- Press,
24
- Frame,
25
- MdxArea,
26
- BaseFigure,
27
- BaseCallout,
28
- } from "@open-press/core";
29
-
30
- import { mdxSource } from "@open-press/core/mdx";
31
- import { Sections, Toc } from "@open-press/core/manuscript";
32
- ```
33
-
34
- `document/index.tsx` default-exports a `<Press>` tree. `Frame` marks fixed-layout pages, `MdxArea` receives measured MDX blocks, and `mdxSource()` declares which MDX files participate in the render pipeline.
35
-
36
- The CLI bin (`open-press`) supports dev / build / preview / validate / pdf / deploy / export commands. It requires a workspace with `openpress.config.mjs` and the surrounding framework files (which the scaffolder installs).
37
-
38
- ## License
39
-
40
- MIT — see [LICENSE](https://github.com/quan0715/open-press/blob/main/LICENSE).
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import * as deployCmd from "./commands/deploy.mjs";
4
- import * as devCmd from "./commands/dev.mjs";
5
- import * as doctorCmd from "./commands/doctor.mjs";
6
- import * as exportCmd from "./commands/export.mjs";
7
- import * as initCmd from "./commands/init.mjs";
8
- import * as inspectCmd from "./commands/inspect.mjs";
9
- import * as pdfCmd from "./commands/pdf.mjs";
10
- import * as previewCmd from "./commands/preview.mjs";
11
- import * as replaceCmd from "./commands/replace.mjs";
12
- import * as renderCmd from "./commands/render.mjs";
13
- import * as searchCmd from "./commands/search.mjs";
14
- import * as typecheckCmd from "./commands/typecheck.mjs";
15
- import * as upgradeCmd from "./commands/upgrade.mjs";
16
- import * as validateCmd from "./commands/validate.mjs";
17
- import { parseOptions } from "./commands/_shared.mjs";
18
- import { loadConfig } from "./runtime/config.mjs";
19
- import { listStylePackSkills } from "./init.mjs";
20
- import { discoverWorkspace } from "./runtime/validation.mjs";
21
-
22
- const COMMANDS = {
23
- init: initCmd,
24
- validate: validateCmd,
25
- inspect: inspectCmd,
26
- search: searchCmd,
27
- replace: replaceCmd,
28
- export: exportCmd,
29
- render: renderCmd,
30
- dev: devCmd,
31
- preview: previewCmd,
32
- typecheck: typecheckCmd,
33
- pdf: pdfCmd,
34
- deploy: deployCmd,
35
- doctor: doctorCmd,
36
- upgrade: upgradeCmd,
37
- };
38
-
39
- const args = process.argv.slice(2);
40
- const command = args.shift();
41
-
42
- try {
43
- const code = await main(command, args);
44
- process.exitCode = code;
45
- } catch (error) {
46
- console.error(error instanceof Error ? error.message : String(error));
47
- process.exitCode = 1;
48
- }
49
-
50
- async function main(commandName, argv) {
51
- if (!commandName || ["-h", "--help"].includes(commandName)) {
52
- await printHelp();
53
- return commandName ? 0 : 2;
54
- }
55
-
56
- const handler = COMMANDS[commandName];
57
- if (!handler) {
58
- console.error(`Unknown command: ${commandName}`);
59
- await printHelp();
60
- return 2;
61
- }
62
-
63
- if (handler.needsWorkspace === false) {
64
- return handler.run({ argv });
65
- }
66
-
67
- const options = parseOptions(argv);
68
- const root = await discoverWorkspace(options.path ?? ".");
69
- const config = await loadConfig(root);
70
- return handler.run({ root, config, options, recurse: main });
71
- }
72
-
73
- async function printHelp() {
74
- const packs = await listStylePackSkills();
75
- const skillList = packs.length ? packs.join(" | ") : "(none installed)";
76
- console.log(`Usage: node engine/cli.mjs <command> [path] [options]
77
-
78
- Commands:
79
- init <target> [--skill <name>] [--force]
80
- validate
81
- inspect [--json] [--no-build] [--dry-run]
82
- search [path] <query> [--json] [--scope content|all]
83
- replace [path] <from> <to> [--json] [--apply] [--scope content|all]
84
- export
85
- render --renderer react [--dry-run]
86
- preview --renderer react [--host 127.0.0.1] [--port 5173] [--no-build] [--dry-run]
87
- dev --renderer react [--host 127.0.0.1] [--port 5173] [--no-build] [--dry-run]
88
- typecheck
89
- pdf [--output <outputDir>/<pdf.filename>] [--no-build] [--dry-run]
90
- deploy --confirm [--dry-run]
91
- doctor [--json] [--no-cache] # version + skill staleness check
92
- upgrade [--dry-run] [--no-deps] [--no-skills] [--json] # apply updates; agent-driven
93
-
94
- Style packs available for \`init --skill\`: ${skillList}
95
- `);
96
- }