gutterpress 0.0.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 (230) hide show
  1. package/README.md +422 -0
  2. package/dist/CGATS21_CRPC1-g0e3k7kr.icc +0 -0
  3. package/dist/api/index.d.ts +76 -0
  4. package/dist/api/index.js +272 -0
  5. package/dist/assets/preview/scripts/pagedjs-bridge.d.ts +1 -0
  6. package/dist/assets/preview/scripts/pagedjs-interface.d.ts +1 -0
  7. package/dist/assets/preview/scripts/preview-shell.d.ts +1 -0
  8. package/dist/audit-1jrwwacz.js +66 -0
  9. package/dist/build-5s92kgpc.js +77 -0
  10. package/dist/chapter-01-6fn9pvd0.md +31 -0
  11. package/dist/chapter-01-7jwqg1ct.md +20 -0
  12. package/dist/chapter-01-jj8ftn4c.md +29 -0
  13. package/dist/chapter-01-rkpyvjna.md +26 -0
  14. package/dist/checks/asset/approved-fonts.d.ts +3 -0
  15. package/dist/checks/asset/extensions.d.ts +41 -0
  16. package/dist/checks/asset/font-license.d.ts +3 -0
  17. package/dist/checks/asset/image-alpha.d.ts +3 -0
  18. package/dist/checks/asset/image-color-space.d.ts +3 -0
  19. package/dist/checks/asset/image-file-size.d.ts +3 -0
  20. package/dist/checks/asset/image-resolution.d.ts +3 -0
  21. package/dist/checks/asset/image-tac.d.ts +3 -0
  22. package/dist/checks/asset/index.d.ts +7 -0
  23. package/dist/checks/formatter.d.ts +3 -0
  24. package/dist/checks/heuristic/index.d.ts +4 -0
  25. package/dist/checks/heuristic/layer-count.d.ts +3 -0
  26. package/dist/checks/heuristic/placement-variance.d.ts +3 -0
  27. package/dist/checks/heuristic/section-density.d.ts +3 -0
  28. package/dist/checks/heuristic/text-density.d.ts +3 -0
  29. package/dist/checks/pdf/bleed.d.ts +3 -0
  30. package/dist/checks/pdf/bookmarks.d.ts +3 -0
  31. package/dist/checks/pdf/color-spaces.d.ts +3 -0
  32. package/dist/checks/pdf/cross-refs.d.ts +3 -0
  33. package/dist/checks/pdf/embedded-fonts.d.ts +3 -0
  34. package/dist/checks/pdf/image-resolution.d.ts +3 -0
  35. package/dist/checks/pdf/index.d.ts +15 -0
  36. package/dist/checks/pdf/ink-coverage.d.ts +3 -0
  37. package/dist/checks/pdf/page-labels.d.ts +3 -0
  38. package/dist/checks/pdf/page-size.d.ts +3 -0
  39. package/dist/checks/pdf/pdfx-markers.d.ts +3 -0
  40. package/dist/checks/pdf/pdfx-metadata.d.ts +3 -0
  41. package/dist/checks/pdf/pdfx-structure.d.ts +6 -0
  42. package/dist/checks/pdf/qpdf-structure.d.ts +3 -0
  43. package/dist/checks/pdf/rasterized-pages.d.ts +3 -0
  44. package/dist/checks/pdf/toc-links.d.ts +3 -0
  45. package/dist/checks/pdf/transparency.d.ts +3 -0
  46. package/dist/checks/policy.d.ts +61 -0
  47. package/dist/checks/register-builtins.d.ts +17 -0
  48. package/dist/checks/registry.d.ts +40 -0
  49. package/dist/checks/runner.d.ts +25 -0
  50. package/dist/checks/source/accessibility-alt-text.d.ts +3 -0
  51. package/dist/checks/source/accessibility-heading-order.d.ts +3 -0
  52. package/dist/checks/source/config-file.d.ts +8 -0
  53. package/dist/checks/source/htmlhint.d.ts +3 -0
  54. package/dist/checks/source/index.d.ts +6 -0
  55. package/dist/checks/source/local-refs.d.ts +3 -0
  56. package/dist/checks/source/markdownlint.d.ts +3 -0
  57. package/dist/checks/source/stylelint.d.ts +3 -0
  58. package/dist/checks/tool-check.d.ts +23 -0
  59. package/dist/checks/types.d.ts +52 -0
  60. package/dist/cli-1tyj4bk3.js +124 -0
  61. package/dist/cli-37x76zdn.js +4 -0
  62. package/dist/cli-506tg37g.js +26 -0
  63. package/dist/cli-5bxx0c4y.js +464 -0
  64. package/dist/cli-7ykx7pp0.js +12378 -0
  65. package/dist/cli-h7phg3ka.js +746 -0
  66. package/dist/cli-hvqjs342.js +284 -0
  67. package/dist/cli-yja077f6.js +92 -0
  68. package/dist/cli.js +157 -0
  69. package/dist/constants.d.ts +17 -0
  70. package/dist/doctor-25zjt8dz.js +57 -0
  71. package/dist/favicon-wkbm9cjn.ico +0 -0
  72. package/dist/git-http-yrb4ag6z.js +17 -0
  73. package/dist/index-1tyj4bk3.js +124 -0
  74. package/dist/index-37x76zdn.js +4 -0
  75. package/dist/index-3h3fef7r.js +15218 -0
  76. package/dist/index-5bxx0c4y.js +464 -0
  77. package/dist/index-yja077f6.js +92 -0
  78. package/dist/index.d.ts +32 -0
  79. package/dist/index.js +310 -0
  80. package/dist/lib/app-heartbeat.d.ts +102 -0
  81. package/dist/lib/asset-inline.d.ts +73 -0
  82. package/dist/lib/browser-pool.d.ts +17 -0
  83. package/dist/lib/build-error.d.ts +52 -0
  84. package/dist/lib/build-fingerprint.d.ts +15 -0
  85. package/dist/lib/build-preflight.d.ts +43 -0
  86. package/dist/lib/build-runner.d.ts +161 -0
  87. package/dist/lib/build-staging.d.ts +64 -0
  88. package/dist/lib/chromium.d.ts +20 -0
  89. package/dist/lib/cli-args.d.ts +45 -0
  90. package/dist/lib/desktop.d.ts +14 -0
  91. package/dist/lib/diagnostics.d.ts +64 -0
  92. package/dist/lib/embedded-assets.d.ts +29 -0
  93. package/dist/lib/exec.d.ts +84 -0
  94. package/dist/lib/fetch-timeout.d.ts +41 -0
  95. package/dist/lib/ghostscript.d.ts +48 -0
  96. package/dist/lib/host-policy.d.ts +75 -0
  97. package/dist/lib/image-inspect.d.ts +32 -0
  98. package/dist/lib/install-hints.d.ts +21 -0
  99. package/dist/lib/lint-runner.d.ts +10 -0
  100. package/dist/lib/manifest-config.d.ts +31 -0
  101. package/dist/lib/manifest-doc.d.ts +25 -0
  102. package/dist/lib/manifest.d.ts +41 -0
  103. package/dist/lib/markdown/assemble.d.ts +78 -0
  104. package/dist/lib/markdown/chapter-id.d.ts +24 -0
  105. package/dist/lib/markdown/images.d.ts +34 -0
  106. package/dist/lib/markdown/index.d.ts +78 -0
  107. package/dist/lib/markdown/markdown-it-paged.d.ts +30 -0
  108. package/dist/lib/markdown/plugins.d.ts +69 -0
  109. package/dist/lib/markdown/renderer.d.ts +111 -0
  110. package/dist/lib/npm-plugin-installer.d.ts +33 -0
  111. package/dist/lib/open-path.d.ts +5 -0
  112. package/dist/lib/output-paths.d.ts +23 -0
  113. package/dist/lib/pagedjs-marker.d.ts +42 -0
  114. package/dist/lib/pagedjs.d.ts +26 -0
  115. package/dist/lib/pagination.d.ts +169 -0
  116. package/dist/lib/pdf-inspect.d.ts +123 -0
  117. package/dist/lib/pdf-parse.d.ts +57 -0
  118. package/dist/lib/plugin-manager.d.ts +108 -0
  119. package/dist/lib/plugin-vendor.d.ts +107 -0
  120. package/dist/lib/presets.d.ts +45 -0
  121. package/dist/lib/printsafe.d.ts +17 -0
  122. package/dist/lib/project-scaffold.d.ts +116 -0
  123. package/dist/lib/project-source.d.ts +140 -0
  124. package/dist/lib/project-templates.d.ts +49 -0
  125. package/dist/lib/publish/butler.d.ts +10 -0
  126. package/dist/lib/publish/command-runner.d.ts +18 -0
  127. package/dist/lib/publish/connect.d.ts +23 -0
  128. package/dist/lib/publish/manifest-publish.d.ts +9 -0
  129. package/dist/lib/publish/providers/azure-swa.d.ts +3 -0
  130. package/dist/lib/publish/providers/drivethrurpg.d.ts +10 -0
  131. package/dist/lib/publish/providers/guided.d.ts +3 -0
  132. package/dist/lib/publish/providers/itch.d.ts +5 -0
  133. package/dist/lib/publish/providers/kdp.d.ts +9 -0
  134. package/dist/lib/publish/providers/shopify.d.ts +5 -0
  135. package/dist/lib/publish/registry.d.ts +5 -0
  136. package/dist/lib/publish/run-publish.d.ts +30 -0
  137. package/dist/lib/publish/selections.d.ts +25 -0
  138. package/dist/lib/publish/types.d.ts +258 -0
  139. package/dist/lib/remote-auth/clone.d.ts +87 -0
  140. package/dist/lib/remote-auth/conflict-resolution.d.ts +29 -0
  141. package/dist/lib/remote-auth/diagnose.d.ts +77 -0
  142. package/dist/lib/remote-auth/generic-auth.d.ts +97 -0
  143. package/dist/lib/remote-auth/git-http.d.ts +85 -0
  144. package/dist/lib/remote-auth/github-auth.d.ts +69 -0
  145. package/dist/lib/remote-auth/github-repos.d.ts +64 -0
  146. package/dist/lib/remote-auth/operation-log.d.ts +66 -0
  147. package/dist/lib/remote-auth/recovery/abort-interrupted-operation.d.ts +103 -0
  148. package/dist/lib/remote-auth/recovery/backup.d.ts +113 -0
  149. package/dist/lib/remote-auth/recovery/classify.d.ts +109 -0
  150. package/dist/lib/remote-auth/recovery/context.d.ts +47 -0
  151. package/dist/lib/remote-auth/recovery/dispatch.d.ts +33 -0
  152. package/dist/lib/remote-auth/recovery/failsafe.d.ts +33 -0
  153. package/dist/lib/remote-auth/recovery/inspect.d.ts +74 -0
  154. package/dist/lib/remote-auth/recovery/manual-guidance.d.ts +28 -0
  155. package/dist/lib/remote-auth/recovery/outcome-mapping.d.ts +58 -0
  156. package/dist/lib/remote-auth/recovery/policy.d.ts +47 -0
  157. package/dist/lib/remote-auth/recovery/recover-auth.d.ts +42 -0
  158. package/dist/lib/remote-auth/recovery/recover-binary-conflict.d.ts +37 -0
  159. package/dist/lib/remote-auth/recovery/recover-corrupt-index.d.ts +40 -0
  160. package/dist/lib/remote-auth/recovery/recover-detached-head.d.ts +70 -0
  161. package/dist/lib/remote-auth/recovery/recover-interrupted-cherry-pick.d.ts +23 -0
  162. package/dist/lib/remote-auth/recovery/recover-interrupted-merge.d.ts +28 -0
  163. package/dist/lib/remote-auth/recovery/recover-interrupted-rebase.d.ts +39 -0
  164. package/dist/lib/remote-auth/recovery/recover-merge-conflict.d.ts +34 -0
  165. package/dist/lib/remote-auth/recovery/recover-missing-git-dir.d.ts +37 -0
  166. package/dist/lib/remote-auth/recovery/recover-missing-objects.d.ts +56 -0
  167. package/dist/lib/remote-auth/recovery/recover-network.d.ts +34 -0
  168. package/dist/lib/remote-auth/recovery/recover-non-fast-forward.d.ts +27 -0
  169. package/dist/lib/remote-auth/recovery/recover-stale-lock.d.ts +76 -0
  170. package/dist/lib/remote-auth/recovery/recover-unrelated-histories.d.ts +44 -0
  171. package/dist/lib/remote-auth/recovery/recover-wrong-remote.d.ts +35 -0
  172. package/dist/lib/remote-auth/recovery/types.d.ts +235 -0
  173. package/dist/lib/remote-auth/resolution-plan.d.ts +64 -0
  174. package/dist/lib/remote-auth/sync-messages.d.ts +26 -0
  175. package/dist/lib/remote-auth/sync-types.d.ts +225 -0
  176. package/dist/lib/remote-auth/sync.d.ts +45 -0
  177. package/dist/lib/remote-auth/test-access.d.ts +47 -0
  178. package/dist/lib/remote-auth/test-support/git-http-server.d.ts +71 -0
  179. package/dist/lib/remote-auth/token-store.d.ts +95 -0
  180. package/dist/lib/remote-auth/transport.d.ts +105 -0
  181. package/dist/lib/slug.d.ts +28 -0
  182. package/dist/lib/snippets.d.ts +39 -0
  183. package/dist/lib/source-provider.d.ts +244 -0
  184. package/dist/lib/static-serve.d.ts +54 -0
  185. package/dist/lib/style-resolver.d.ts +30 -0
  186. package/dist/lib/theme-import.d.ts +70 -0
  187. package/dist/lib/theme-manager.d.ts +128 -0
  188. package/dist/lib/tool-probe.d.ts +37 -0
  189. package/dist/lib/validation-exec.d.ts +47 -0
  190. package/dist/lib/validation-profile.d.ts +18 -0
  191. package/dist/lib/version.d.ts +9 -0
  192. package/dist/lint-f63nxjfj.js +65 -0
  193. package/dist/manifest-n1gh3qw5.yaml +9 -0
  194. package/dist/manifest-ryyg71nf.yaml +9 -0
  195. package/dist/manifest.schema-rn1dpdpn.json +564 -0
  196. package/dist/new-7b08a42h.js +105 -0
  197. package/dist/paged.polyfill-n95pbxfn.js +33288 -0
  198. package/dist/pagedjs-bridge-vn4hk9fx.js +111 -0
  199. package/dist/pagedjs-interface-80g3xa8p.js +498 -0
  200. package/dist/platform.d.ts +100 -0
  201. package/dist/plugin-wf2cbmwc.js +129 -0
  202. package/dist/preflight-tg4mpz1h.js +222 -0
  203. package/dist/preview/file-watcher.d.ts +174 -0
  204. package/dist/preview/http-server.d.ts +45 -0
  205. package/dist/preview/lifecycle.d.ts +67 -0
  206. package/dist/preview/server-context.d.ts +36 -0
  207. package/dist/preview-h2bwbb2x.js +102 -0
  208. package/dist/preview-shell-rghtfmc8.js +155 -0
  209. package/dist/project-source-0tg0r6vm.js +17 -0
  210. package/dist/publish-ztaet53r.js +233 -0
  211. package/dist/render.d.ts +20 -0
  212. package/dist/render.js +682 -0
  213. package/dist/repair-jkp4n3j8.js +171 -0
  214. package/dist/schema/manifest.types.d.ts +218 -0
  215. package/dist/server.d.ts +34 -0
  216. package/dist/source-provider-hp96b5jf.js +46 -0
  217. package/dist/test-helpers/testkit.d.ts +91 -0
  218. package/dist/theme-0yzvthe8.css +65 -0
  219. package/dist/theme-570zmh2t.css +58 -0
  220. package/dist/theme-6a2fngc8.json +6 -0
  221. package/dist/theme-cd6efzjw.json +6 -0
  222. package/dist/theme-nya4nqh6.css +70 -0
  223. package/dist/theme-tqfypc1w.json +6 -0
  224. package/dist/theme-xt0hjb1b.json +6 -0
  225. package/dist/theme-zz2ktzqs.css +60 -0
  226. package/dist/types.d.ts +31 -0
  227. package/dist/utils/file-utils.d.ts +53 -0
  228. package/dist/utils/logger.d.ts +59 -0
  229. package/dist/validate-k2drs19j.js +99 -0
  230. package/package.json +102 -0
package/README.md ADDED
@@ -0,0 +1,422 @@
1
+ # Gutterpress
2
+
3
+ Command-line interface for Gutterpress — markdown to print-ready PDF.
4
+
5
+ The CLI is for power users who want to script builds, run in CI, batch-process projects, or work outside the desktop app. If you just want to write a book and export a PDF, use the [desktop app](https://github.com/dimm-city/gutterpress#get-the-desktop-app) instead.
6
+
7
+ ## Install
8
+
9
+ ### Standalone binary (no Node, no Bun required)
10
+
11
+ Download for your platform from the [latest release](https://github.com/dimm-city/gutterpress/releases/latest):
12
+
13
+ | Platform | Binary |
14
+ |---|---|
15
+ | Linux x64 | `gutterpress-linux-x64` |
16
+ | Linux ARM64 | `gutterpress-linux-arm64` |
17
+ | macOS Apple Silicon | `gutterpress-macos-arm64` |
18
+ | macOS Intel | `gutterpress-macos-x64` |
19
+ | Windows x64 | `gutterpress-windows-x64.exe` |
20
+
21
+ Move the binary somewhere on your `PATH`, mark it executable (`chmod +x`), and you're done.
22
+
23
+ Every new GitHub release includes `SHA256SUMS.txt`. Verify the hash for your
24
+ download before running it, especially when bypassing Gatekeeper or
25
+ SmartScreen. See the [installation guide](../../docs/installing.md) for
26
+ commands and the complete supported-platform matrix.
27
+
28
+ ### From Homebrew (macOS and Linux)
29
+
30
+ ```sh
31
+ brew tap dimm-city/gutterpress https://github.com/dimm-city/gutterpress.git
32
+ brew install dimm-city/gutterpress/gutterpress
33
+ ```
34
+
35
+ ### From Scoop (Windows x64)
36
+
37
+ ```powershell
38
+ scoop bucket add gutterpress https://github.com/dimm-city/gutterpress.git
39
+ scoop install gutterpress/gutterpress
40
+ ```
41
+
42
+ ### From npm
43
+
44
+ ```sh
45
+ npm install -g gutterpress
46
+ ```
47
+
48
+ Node.js 22 or newer is required for the npm install.
49
+
50
+ Installing with an npm git URL is intentionally unsupported. This repository
51
+ is a Bun monorepo, its generated `dist/` is not committed, and the repository
52
+ root is not the published CLI package. Use one of the installs above, or clone
53
+ the repository and run `bun install` when contributing to Gutterpress itself.
54
+
55
+ ## System requirements
56
+
57
+ The CLI needs a Chromium-based browser for PDF generation, and a few external tools for PDF post-processing and validation depending on which features you use. See [User Guide: Chapter 8 — System Setup](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/08-system-setup.md) for the full per-feature requirements matrix.
58
+
59
+ The short version: CLI PDF rendering needs a Chromium-based browser. Optional
60
+ PDF/X output additionally needs **Ghostscript** and **qpdf**; the desktop app
61
+ uses its bundled browser for standard PDF export.
62
+
63
+ ## Quick start
64
+
65
+ ```sh
66
+ # Scaffold a new project (manifest + starter chapter + stylesheet)
67
+ gutterpress new "My First Book"
68
+
69
+ # Build a PDF from a project directory
70
+ gutterpress build ./my-book
71
+
72
+ # Live preview server (Paged.js + websocket-driven full-reload on file change)
73
+ gutterpress preview ./my-book
74
+
75
+ # Custom output path
76
+ gutterpress build ./my-book --out dist/my-book.pdf
77
+
78
+ # Print-ready PDF/X (CMYK + ICC profile, validation enabled)
79
+ gutterpress build ./my-book --format pdfx --icc path/to/profile.icc
80
+
81
+ # HTML output (a self-contained directory with book.html + assets)
82
+ gutterpress build ./my-book --format html --out dist/my-book/
83
+ ```
84
+
85
+ ## Project layout
86
+
87
+ A Gutterpress project is a directory. The CLI doesn't impose much structure; the most common shape is:
88
+
89
+ ```
90
+ my-book/
91
+ ├─ manifest.yaml ← optional but recommended; metadata + config
92
+ ├─ chapter-01.md ← markdown files, processed in alphabetical order
93
+ ├─ chapter-02.md (or in the order listed in manifest.yaml#source.files)
94
+ ├─ css/ ← your stylesheets
95
+ │ └─ print.css
96
+ └─ images/ ← images referenced from markdown or CSS
97
+ ```
98
+
99
+ The CLI discovers assets from what the book actually references — there is no
100
+ directory list to keep in sync. Fonts are no exception: a font can live
101
+ anywhere in the project; `@font-face { src: url(...) }` in your CSS resolves
102
+ relative to that CSS file, wherever it is, and the build embeds it
103
+ automatically. Images referenced from markdown or HTML must live inside the
104
+ project folder (they keep their own relative path in the output); images
105
+ referenced only from CSS may live anywhere the CSS can reach.
106
+
107
+ See [User Guide: Chapter 1 — Getting Started](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/01-getting-started.md) for a full first-project walkthrough and [examples/](https://github.com/dimm-city/gutterpress/tree/main/examples) for working starters.
108
+
109
+ ## Manifest
110
+
111
+ `manifest.yaml` is where you control everything that isn't authored in markdown — book title, the page-size preset, custom styles, plugin loading, validation rules, PDF/X configuration. It is the only recognized project manifest filename. The schema lives in [`docs/schema-autocomplete.md`](https://github.com/dimm-city/gutterpress/blob/main/docs/schema-autocomplete.md) for YAML autocomplete in editors.
112
+
113
+ Minimal example:
114
+
115
+ ```yaml
116
+ title: "My Book"
117
+ authors:
118
+ - "Your Name Here"
119
+
120
+ # Pick a page-size preset or supply page.width / page.height yourself
121
+ preset: dtrpg
122
+
123
+ styles:
124
+ - css/print.css
125
+
126
+ source:
127
+ files:
128
+ - chapter-01.md
129
+ - chapter-02.md
130
+ ```
131
+
132
+ The full configuration cascade is `CLI flags > manifest.yaml > preset defaults`. See the [configuration reference](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/01-getting-started.md#manifest-configuration) for details.
133
+
134
+ ## Commands
135
+
136
+ Gutterpress has 11 subcommands. `new`, `preview`, `build`, and `publish` are the
137
+ primary author commands; `lint`, `validate`, `audit`, and `preflight` are
138
+ CI / advanced checks; `repair` is the version-history escape hatch; and
139
+ `doctor` reports system readiness. `plugin` manages project plugins. Every
140
+ command also accepts `--help` for the authoritative, always-current flag list
141
+ (`gutterpress <command> --help`) — this section is regenerated from the same
142
+ source.
143
+
144
+ ### `gutterpress new`
145
+
146
+ Scaffold a new project from an embedded starter template — the fastest way to start writing (see [Quick start](#quick-start)).
147
+
148
+ ```sh
149
+ gutterpress new <name> [options]
150
+
151
+ --author <name> Author name to record in the project
152
+ --dir <path> Parent directory to create the project in (default: current directory)
153
+ --folder <name> Folder name to create (default: a slug of the project name)
154
+ --template <id> Starter template: book, ttrpg, zine, technical (default: book)
155
+ --git Initialise local version history (default: true; use --no-git to skip)
156
+ --no-git
157
+ ```
158
+
159
+ ### `gutterpress preview`
160
+
161
+ Live HTML preview server by default (serves `book.html`, triggers full-reload via WebSocket on file change — pure JS rendering, no external tools). Pass `--format pdf` or `--format pdfx` for a one-shot build-and-open instead of the live server. `--manifest` applies only to those one-shot PDF/PDF-X modes; live HTML preview discovers the project manifest from its input directory.
162
+
163
+ ```sh
164
+ gutterpress preview [input-dir] [options]
165
+
166
+ --format <fmt> html (default, live HMR) | pdf | pdfx
167
+ --port <n> Bind port (default: 3579, html only)
168
+ --host <h> Bind host (default: 127.0.0.1). Pass 0.0.0.0 to expose on the LAN.
169
+ --no-watch Disable file watching (html only)
170
+ --open Automatically open browser (default: true; use --no-open to skip)
171
+ --no-open
172
+ --verbose Enable verbose output
173
+ --debug Debug mode (preserve temporary files)
174
+ --out <dir> Output directory (pdf|pdfx only)
175
+ --pdfx-flavor <flavor> PDF/X flavor: x1a | x3 (pdfx only)
176
+ --icc <path> Path to ICC profile (required for --format pdfx)
177
+ --manifest <path> Path to manifest.yaml (pdf|pdfx only)
178
+ --strip-annotations Strip PDF annotations for PDF/X compliance (pdfx only)
179
+ --skip-lint Skip CSS linting (pdf|pdfx only)
180
+ --skip-pre-validate Skip pre-build validation (pdf|pdfx only)
181
+ --skip-post-validate Skip post-build PDF/X validation (pdfx only)
182
+ ```
183
+
184
+ ### `gutterpress build`
185
+
186
+ Build a PDF (default) or HTML output. Pipeline: `lint → validate:pre → convert → assets → build → validate:post`.
187
+
188
+ ```sh
189
+ gutterpress build [input-dir] [options]
190
+
191
+ --format <fmt> pdf | pdfx | html (default: pdf)
192
+ --out <path> Output file or directory. For pdf|pdfx, --out may also be a .pdf file path.
193
+ --title <title> Override manifest title
194
+ --pdfx-flavor <flavor> PDF/X flavor: x1a | x3 (--format pdfx only)
195
+ --icc <path> Path to ICC profile (required for --format pdfx)
196
+ --manifest <path> Path to manifest.yaml
197
+ --strip-annotations Strip PDF annotations for PDF/X compliance
198
+ --skip-lint Skip the CSS print-safety pass (default: lint runs for pdf/pdfx)
199
+ --skip-pre-validate Skip pre-build validation
200
+ --skip-post-validate Skip post-build PDF/X validation
201
+ ```
202
+
203
+ ### `gutterpress publish`
204
+
205
+ Push a built PDF/HTML artifact to a publishing platform (itch.io, DriveThruRPG, Amazon KDP, Azure Static Web Apps, Shopify), headlessly and CI-safely. Credentials live in a 0600 user-config store (never in the project); provider env vars override it for CI.
206
+
207
+ ```sh
208
+ gutterpress publish [project] [options]
209
+
210
+ --provider <id> itch | drivethrurpg | kdp | azure-swa | shopify
211
+ --list List providers and connection status
212
+ --connect Store an API key for --provider (from --token, the provider's env var, or piped stdin)
213
+ --disconnect Forget the stored key for --provider
214
+ --account <label> Named-credential label for --connect/--disconnect (keep several accounts per provider); omit for the default
215
+ --token <key> API key for --connect (prefer stdin/env var to keep it out of shell history)
216
+ --file <path> Artifact to publish (PDF path, or HTML export dir). Default: the manifest's output location
217
+ --manifest <path> Path to manifest.yaml
218
+ --dry-run Preflight only; don't contact the platform
219
+ --json Machine-readable JSON output (CI)
220
+ --open Open the result page / guided upload page in the browser
221
+ ```
222
+
223
+ ```sh
224
+ # List providers and connection status
225
+ gutterpress publish --list
226
+
227
+ # Store an API key for itch.io, then publish
228
+ gutterpress publish --provider itch --connect
229
+ gutterpress publish --provider itch ./my-book
230
+ ```
231
+
232
+ ### `gutterpress lint`
233
+
234
+ Run Gutterpress's print-safety CSS checks (postcss-based: remote URLs, rasterizing effects, Paged.js crash-prone selectors) against the project's CSS files.
235
+
236
+ ```sh
237
+ gutterpress lint [files] [options]
238
+
239
+ --manifest <path> Path to manifest.yaml
240
+ ```
241
+
242
+ `files` is a positional: either a project directory containing `manifest.yaml` (its configured stylesheets are linted), or a glob pattern for CSS files to lint directly. There is no `--files` flag — pass the directory/glob as the positional.
243
+
244
+ Common print-unsafe patterns the plugin flags: remote `url(...)` references in CSS, paged.js-crashing `:is()`-with-sibling selectors, properties with no print equivalent.
245
+
246
+ ### `gutterpress validate`
247
+
248
+ Run the validation pipeline (pre-build source checks and/or post-build PDF checks). Tools that aren't installed are skipped with a warning — they don't fail the run. See [User Guide: Chapter 7 — Validation](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/07-validation.md) for the full check list and [User Guide: Chapter 8 — System Setup](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/08-system-setup.md) for which external tools each check needs.
249
+
250
+ The positional directory and `--pdf`/`--input` are independent: the positional (or `--input`) sets the pre-build source directory, `--pdf` separately points at a built PDF for post-build checks. `--input` overrides the positional if both are given.
251
+
252
+ ```sh
253
+ gutterpress validate [dir] [options]
254
+
255
+ --pdf <path> Path to the PDF file to validate (post-build checks)
256
+ --input <dir> Source directory for pre-build checks (overrides the positional directory)
257
+ --manifest <path> Path to manifest.yaml
258
+ --category <c> Comma-separated categories: source, pdf, asset, heuristic
259
+ --only <ids> Run only these check IDs/selectors (comma-separated)
260
+ --skip <ids> Skip these check IDs/selectors (comma-separated)
261
+ --format <fmt> text (default) | json
262
+ --phase <p> pre | post | all | pre-build | post-build (default: all)
263
+ --profile <p> Validation profile lock (currently: dtrpg)
264
+ ```
265
+
266
+ ### `gutterpress audit`
267
+
268
+ Run asset-only validation checks (image DPI/format/color-space, print-readiness) without the rest of the validation pipeline.
269
+
270
+ ```sh
271
+ gutterpress audit [dir] [options]
272
+
273
+ --input <dir> Asset directory (overrides the positional directory)
274
+ --manifest <path> Path to manifest.yaml
275
+ --only <ids> Run only these check IDs/selectors (comma-separated)
276
+ --skip <ids> Skip these check IDs/selectors (comma-separated)
277
+ --format <fmt> text (default) | json
278
+ ```
279
+
280
+ ### `gutterpress preflight`
281
+
282
+ Run a deterministic print preflight against an already-built PDF and write a GO/FIX/NO-GO report (JSON + Markdown) — the automatable gate for CI before handing a PDF to a printer.
283
+
284
+ ```sh
285
+ gutterpress preflight [dir] --pdf <path> [options]
286
+
287
+ --pdf <path> Path to the PDF file to preflight (required)
288
+ --input <dir> Optional source directory for pre-build checks (overrides the positional directory)
289
+ --manifest <path> Path to manifest.yaml
290
+ --profile <p> Validation profile lock (currently: dtrpg)
291
+ --report-dir <dir> Output directory for preflight reports (default: alongside the PDF)
292
+ --name <name> Base filename for report outputs
293
+ ```
294
+
295
+ Exits 1 when the computed status is `NO-GO` (errors, or a required check skipped/failed).
296
+
297
+ ### `gutterpress repair`
298
+
299
+ Diagnose and repair the project's version history — no git knowledge (and no system git) required. Detects the states that block syncing (an update that didn't finish, a leftover lock from a crash, a damaged or missing history) and applies the same safe repair the desktop app offers: a safety-copy zip is saved first, and nothing changes without your confirmation.
300
+
301
+ ```sh
302
+ gutterpress repair [dir]
303
+
304
+ --check Diagnose only — never change anything (exit 1 when repair is needed)
305
+ --yes Approve the repair without prompting
306
+ --force Repair even if the Gutterpress app appears to have this project open
307
+ ```
308
+
309
+ ### `gutterpress doctor`
310
+
311
+ Report the Gutterpress version, platform and config paths, and whether each external tool is available. Missing tools include the features that use them and platform-specific installation guidance.
312
+
313
+ ```sh
314
+ gutterpress doctor
315
+ ```
316
+
317
+ ### `gutterpress plugin`
318
+
319
+ Manage project markdown-it plugins.
320
+
321
+ ```sh
322
+ gutterpress plugin
323
+
324
+ --help Show plugin subcommands
325
+ ```
326
+
327
+ #### `gutterpress plugin add`
328
+
329
+ Download a markdown-it package and its runtime dependencies directly from npm,
330
+ verify their registry hashes, vendor the complete graph into the project, and
331
+ pin the exact root version. This does not invoke npm, Bun, Node.js tooling, or
332
+ package install scripts.
333
+
334
+ ```sh
335
+ gutterpress plugin add markdown-it-highlightjs ./my-book
336
+ gutterpress plugin add markdown-it-highlightjs@4.3.0 ./my-book
337
+ gutterpress plugin add markdown-it-emoji@3.0.0 ./my-book --export full
338
+ ```
339
+
340
+ ## Exit codes
341
+
342
+ Every command follows the same exit-code contract, so CI can branch on the result without parsing output:
343
+
344
+ | Code | Meaning |
345
+ |---|---|
346
+ | `0` | Clean — no findings, nothing to fix. |
347
+ | `1` | Findings — the command ran fine but reported findings/validation failures (`lint` CSS errors, `validate`/`preflight`/`audit` findings, a `build` quality-gate rejection). |
348
+ | `2` | Usage — the invocation itself was wrong: a bad flag, positional argument, preset, or value. |
349
+ | `3` | Pipeline — the build/render/export pipeline itself failed for a reason unrelated to usage or findings (I/O error, missing tool, renderer crash). |
350
+
351
+ This applies uniformly across `build`, `preview`, `lint`, `validate`, `preflight`, `audit`, `repair`, `publish`, `plugin`, `new`, and `doctor`.
352
+
353
+ ## Plugins
354
+
355
+ Gutterpress uses [markdown-it](https://github.com/markdown-it/markdown-it) under the hood, so pure-JavaScript plugins that follow the `(md, options) => void` signature work without a Gutterpress-specific API. Load them in `manifest.yaml`:
356
+
357
+ ```yaml
358
+ plugins:
359
+ # npm package installed by `gutterpress plugin add markdown-it-highlightjs`
360
+ - name: markdown-it-highlightjs
361
+ version: 4.3.0
362
+ # package whose plugin function is a named export
363
+ - name: markdown-it-emoji
364
+ version: 3.0.0
365
+ export: full
366
+ # local file
367
+ - ./plugins/my-custom-plugin.js
368
+ # with options
369
+ - name: markdown-it-footnote
370
+ options:
371
+ includeSubsections: false
372
+ # explicit priority (lower runs first)
373
+ - name: markdown-it-anchor
374
+ priority: 10
375
+ ```
376
+
377
+ Pinned npm packages and their runtime dependencies live under `plugins/npm/`,
378
+ with a receipt that records the exact graph and hashes the complete tree. They
379
+ travel with the project and builds never fetch from the registry. Install/build
380
+ scripts, native addon compilation, bundled `node_modules`, and non-registry
381
+ dependency selectors are intentionally unsupported. Only install packages you
382
+ trust: plugins run unsandboxed with the process's full filesystem and network
383
+ privileges.
384
+
385
+ Use the manifest `export` field, or `plugin add --export <name>`, for packages
386
+ that expose a named plugin function instead of a default export.
387
+
388
+ See [User Guide: Chapter 6 — Plugins](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/06-plugins.md) for authoring custom plugins.
389
+
390
+ ## CI / scripting
391
+
392
+ The standalone binary is the easiest way — drop it in a GitHub Actions step and you're done:
393
+
394
+ ```yaml
395
+ - name: Build PDF
396
+ run: |
397
+ curl -L -o gutterpress \
398
+ https://github.com/dimm-city/gutterpress/releases/latest/download/gutterpress-linux-x64
399
+ chmod +x gutterpress
400
+ sudo apt-get install -y google-chrome-stable ghostscript
401
+ ./gutterpress build ./my-book --out dist/my-book.pdf
402
+ ```
403
+
404
+ The binary is self-contained except for the system tools described in [User Guide: Chapter 8 — System Setup](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/08-system-setup.md). On a runner with Chrome and Ghostscript present, you don't need a separate Node or Bun install.
405
+
406
+ ## Troubleshooting
407
+
408
+ - **`Ghostscript executable not found`** — Ghostscript is required only for PDF/X and ink-coverage checks. Standard Windows installs are auto-detected; for a non-standard install, set `GHOSTSCRIPT_PATH` to the full path of `gs`, `gswin64c.exe`, or `gswin32c.exe`. See [User Guide: Chapter 8 — System Setup](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/08-system-setup.md).
409
+ - **`No Chrome or Chromium binary found`** — install a Chromium-based browser or set `CHROMIUM_PATH=/path/to/chrome`. The desktop app includes its own browser and needs no separate browser install.
410
+ - **`Tool "X" not found — skipping`** during validate — that's the graceful path; the check requires `X` and isn't available. Install the tool or accept the skip.
411
+ - **All validate checks skipped on Windows** — was a bug pre-0.1.7 (used `which`, which isn't on stock Windows); fixed to use `where.exe`.
412
+
413
+ ## Links
414
+
415
+ - [GitHub repository](https://github.com/dimm-city/gutterpress)
416
+ - [Report an issue](https://github.com/dimm-city/gutterpress/issues)
417
+ - [Full user guide](https://github.com/dimm-city/gutterpress/tree/main/examples/gutterpress-user-guide)
418
+ - [Desktop app](https://github.com/dimm-city/gutterpress/releases/latest)
419
+
420
+ ## License
421
+
422
+ [MPL-2.0](https://github.com/dimm-city/gutterpress/blob/main/LICENSE)
Binary file
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Runtime library API for gutterpress.
3
+ *
4
+ * Consumers (the bundled Electron + SvelteKit desktop, programmatic users)
5
+ * import from `gutterpress` and call these functions with the same
6
+ * shape the citty CLI builds from argv — no subprocess, no JSON IPC.
7
+ *
8
+ * Example:
9
+ * import { runBuild, startPreviewServer } from "gutterpress";
10
+ * const { url, stop } = await startPreviewServer({ input: "./book", installSignalHandlers: false });
11
+ * await runBuild({ inputDir: "./book", format: "pdf", outDir: "./out", rawArgs: {} });
12
+ */
13
+ export { runBuild, splitOutPath, BuildError, type BuildFormat, type PdfxFlavor, type BuildRunnerOptions, type BuildRunnerResult, type SplitOutPath, type PdfRenderer, type PdfRenderInput, } from "../lib/build-runner";
14
+ export { startPreviewServer, type PreviewServerHandle, type StartPreviewServerOptions, } from "../server";
15
+ export type { PreviewServerOptions } from "../types";
16
+ export { loadManifestWithPath, resolveConfig, MANIFEST_FILENAMES, hasProjectManifest, } from "../lib/manifest";
17
+ export type { GutterpressManifest, ResolvedConfig, } from "../schema/manifest.types";
18
+ export type { GutterpressPlugin, GutterpressPluginExport, GutterpressPluginMetadata, } from "../lib/markdown/plugins";
19
+ export { getSystemDiagnostics, } from "../lib/diagnostics";
20
+ export type { ToolStatus, SystemDiagnostics, } from "../lib/diagnostics";
21
+ export { detectProjectSource, capabilitiesFor, findEnclosingRepoDir, repoSubPath, } from "../lib/project-source";
22
+ export type { ProjectSource, ProjectCapabilities, } from "../lib/project-source";
23
+ export { scaffoldProject, adoptFolder, slugifyProjectName, escapeYamlScalar, } from "../lib/project-scaffold.ts";
24
+ export type { ProjectTemplateId, ProjectVersionHistoryMode, CreateProjectOptions, AdoptFolderOptions, CreateProjectResult, CreateProjectErrorCode, CreateProjectError, } from "../lib/project-scaffold.ts";
25
+ export { listBuiltInTemplates, listCustomTemplates, saveProjectAsTemplate, importTemplateFromFolder, BUILT_IN_TEMPLATE_IDS, } from "../lib/project-templates.ts";
26
+ export type { TemplateInfo, SaveProjectAsTemplateOptions, } from "../lib/project-templates.ts";
27
+ export { extractVariables, substituteVariables, listSnippets, readSnippet, saveSnippet, deleteSnippet, SNIPPETS_DIR, } from "../lib/snippets.ts";
28
+ export type { SnippetEntry } from "../lib/snippets.ts";
29
+ export { listProjectPlugins, setPluginEnabled, addLocalPlugin, addNpmPlugin, validateProjectPlugins, RECOMMENDED_PLUGINS, PLUGINS_DIR, } from "../lib/plugin-manager.ts";
30
+ export type { ProjectPluginEntry, PluginValidationResult, RecommendedPlugin, PluginKind, } from "../lib/plugin-manager.ts";
31
+ export { listBuiltInThemes, resolveBuiltInTheme, listProjectThemes, getActiveTheme, applyTheme, importThemeFromFolder, importThemeFromUrl, readThemeCss, removeProjectTheme, getPreviousTheme, revertTheme, BUILT_IN_THEME_IDS, THEMES_DIR, } from "../lib/theme-manager.ts";
32
+ export type { ThemeInfo, ThemeMetadata, ResolvedTheme, ApplyThemeTarget, BuiltInThemeId, } from "../lib/theme-manager.ts";
33
+ export { importThemeFromFile } from "../lib/theme-import.ts";
34
+ export type { ThemeImportResult, ThemeImportWarning } from "../lib/theme-import.ts";
35
+ export { listProjectStyles, resolveActiveStyles } from "../lib/style-resolver.ts";
36
+ export type { ProjectStyle } from "../lib/style-resolver.ts";
37
+ export { readManifestFields, setManifestFields, setActiveStyles, } from "../lib/manifest-config.ts";
38
+ export type { ProjectConfigFields } from "../lib/manifest-config.ts";
39
+ export { providerFor, restoreVersionWithBackup, isNoChangesError, AUTO_SNAPSHOT_MESSAGE, RESTORE_BACKUP_MESSAGE, HISTORY_PAGE_LIMIT, } from "../lib/source-provider.ts";
40
+ export type { ListHistoryOptions, HistoryPage, } from "../lib/source-provider.ts";
41
+ export { appHeartbeatPath, heartbeatTtlMs, isAppHeartbeatFresh, readAppHeartbeat, removeAppHeartbeat, writeAppHeartbeat, APP_HEARTBEAT_FRESH_MS, } from "../lib/app-heartbeat.ts";
42
+ export type { AppHeartbeat } from "../lib/app-heartbeat.ts";
43
+ export { autoSnapshotDelayMs, autoSyncDelayMs, isGitInternalPath, AUTO_SNAPSHOT_MIN_MINUTES, AUTO_SNAPSHOT_MAX_MINUTES, AUTO_SNAPSHOT_DEFAULT_MINUTES, AUTO_SYNC_MIN_MINUTES, AUTO_SYNC_MAX_MINUTES, AUTO_SYNC_DEFAULT_MINUTES, } from "../lib/host-policy.ts";
44
+ export type { AutoSnapshotPolicy, AutoSyncPolicy, } from "../lib/host-policy.ts";
45
+ export { FileTokenStore, defaultConfigDir, redactCredential, extractUrlCredential, migrateUrlCredential, } from "../lib/remote-auth/token-store.ts";
46
+ export type { HostCredential, TokenStore, UrlCredentialExtraction, } from "../lib/remote-auth/token-store.ts";
47
+ export { GitHubAuthProvider, resolveGitHubClientId, GITHUB_HOST, } from "../lib/remote-auth/github-auth.ts";
48
+ export type { RemoteAuthProvider, HostCallbacks, DeviceCodeInfo, GitHubAuthProviderOptions, } from "../lib/remote-auth/github-auth.ts";
49
+ export { listGitHubRepositories, listGitHubBranches, listRepoBooks, } from "../lib/remote-auth/github-repos.ts";
50
+ export type { RemoteRepository, RemoteBranch, RepoBook, } from "../lib/remote-auth/github-repos.ts";
51
+ export { cloneRepository, readProjectProvenance, provenancePath, sanitizeCloneFolderName, } from "../lib/remote-auth/clone.ts";
52
+ export type { CloneRepositoryOptions, CloneRepositoryResult, CloneProgressEvent, ProjectProvenance, } from "../lib/remote-auth/clone.ts";
53
+ export { testRemoteAccess, isSshRemoteUrl, } from "../lib/remote-auth/test-access.ts";
54
+ export type { RemoteAccessResult, RemoteAccessFailureReason, TestRemoteAccessOptions, } from "../lib/remote-auth/test-access.ts";
55
+ export { GenericTokenAuthProvider, connectGenericHost, knownForgeTokenUrl, normalizeForgeHost, } from "../lib/remote-auth/generic-auth.ts";
56
+ export type { GenericTokenConnectInput, GenericHostCallbacks, GenericAuthOptions, } from "../lib/remote-auth/generic-auth.ts";
57
+ export { diagnoseProjectRemote, parseRemoteOrigin, forgeKindForHost, } from "../lib/remote-auth/diagnose.ts";
58
+ export type { ProjectRemoteDiagnosis, DiagnoseProjectRemoteOptions, RemoteProtocol, RemoteGuidanceId, ForgeKind, } from "../lib/remote-auth/diagnose.ts";
59
+ export { syncProject, pullChanges, pushChanges, resolveConflicts, onlineCopyPath, SYNC_SNAPSHOT_MESSAGE, } from "../lib/remote-auth/sync.ts";
60
+ export type { SyncOutcome, PullOutcome, PushOutcome, SyncProjectOptions, ResolveConflictsOptions, ConflictFile, ConflictKind, ConflictResolution, } from "../lib/remote-auth/sync.ts";
61
+ export type { SnapshotEntry, InitVersionHistoryOptions, SnapshotOptions, RestoreSnapshotOptions, RestoreVersionOptions, RestoreVersionResult, SourceProvider, } from "../lib/source-provider.ts";
62
+ export { runPublish, resolvePublishRequest, } from "../lib/publish/run-publish.ts";
63
+ export type { RunPublishOptions, RunPublishResult, } from "../lib/publish/run-publish.ts";
64
+ export { listPublishProviders, publishProviderFor, } from "../lib/publish/registry.ts";
65
+ export { connectPublishProvider } from "../lib/publish/connect.ts";
66
+ export type { ConnectPublishProviderOptions } from "../lib/publish/connect.ts";
67
+ export { publishConnectionStatus, publishCredentialKey, listPublishAccounts, } from "../lib/publish/types.ts";
68
+ export type { PublishSavedAccount } from "../lib/publish/types.ts";
69
+ export { PublishSelectionsStore } from "../lib/publish/selections.ts";
70
+ export type { PublishAccountSelection } from "../lib/publish/selections.ts";
71
+ export { readPublishSettings, setPublishProviderConfig, } from "../lib/publish/manifest-publish.ts";
72
+ export type { PublishProvider, PublishProviderId, PublishProviderInfo, PublishProviderKind, PublishConfigField, PublishArtifact, PublishArtifactFormat, PublishAuthStatus, PublishDeps, PublishListingMetadata, PublishOutcome, PublishProduct, PublishProject, PublishRequest, PreflightIssue, CommandRunner, CommandResult, } from "../lib/publish/types.ts";
73
+ export { recover, classifyGitError, classifyFromHealth, inspectRepo, buildRecoveryContext, preflightStructuralReason, buildPreflightDiagnostics, verifyRepoReadable, isUnbornRepo, RepoNeedsRecoveryError, isRepoNeedsRecoveryError, } from "../lib/remote-auth/recovery/dispatch.ts";
74
+ export { resolveLogger, shortOid } from "../lib/remote-auth/operation-log.ts";
75
+ export type { OperationLogger, LogData } from "../lib/remote-auth/operation-log.ts";
76
+ export type { RecoverFn, RecoveryContext, RecoveryResult, SyncErrorKind, RecoveryRisk, ManualGuidance, RepoHealth, RecoveryBackup, RepairConfirmation, ConfirmationGate, FaultInjector, FaultPoint, } from "../lib/remote-auth/recovery/dispatch.ts";