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
@@ -0,0 +1,45 @@
1
+ import type { ResolvedConfig } from "../schema/manifest.types";
2
+ export type VendorPreset = Omit<ResolvedConfig, "title" | "authors">;
3
+ export declare const DTRPG_PRESET: VendorPreset;
4
+ /**
5
+ * A neutral, vendor-agnostic default for authors who aren't targeting a
6
+ * specific print vendor (UX finding M48). Standard 6x9in trade-book trim size,
7
+ * no vendor total-area-coverage (TAC) cap, and no PDF/X forcing:
8
+ *
9
+ * - `page`: 6in x 9in (432 x 648pt) — the common generic trade paperback trim.
10
+ * Authors targeting a different size still set `page.width`/`page.height`
11
+ * directly; this is a starting point, not a lock-in.
12
+ * - `ink.maxTac: 400` — 400% is the physical ceiling for 4-color process ink
13
+ * (100% each of C+M+Y+K), so `pdf.print.ink-coverage` effectively never
14
+ * fires unless the author opts into a real vendor limit.
15
+ * - `validate.checks`: keeps the generic, vendor-agnostic PDF health checks
16
+ * (`pdf.structure.qpdf` parses/traverses, `pdf.print.embedded-fonts` are
17
+ * embedded) but does NOT force `pdf.print.pdfx-markers` /
18
+ * `pdf.print.pdfx-metadata` — those assert PDF/X OutputIntent/DOCINFO
19
+ * structure, which only applies to a PDF/X build (`--format pdfx`).
20
+ * - `validate.pdf.forbidTransparency: false` and `assets.allowAlpha: true` —
21
+ * PDF/X forbids both; a plain PDF/HTML book has no such restriction.
22
+ * - `validate.assets.allowedColorSpaces` includes RGB (not just CMYK/Grayscale)
23
+ * since a generic book isn't assumed to be prepping for CMYK print-only
24
+ * distribution.
25
+ */
26
+ export declare const BOOK_PRESET: VendorPreset;
27
+ export declare const PRESETS: Record<string, VendorPreset>;
28
+ export declare function warnOnce(id: string, message: string, sink?: (msg: string) => void): void;
29
+ /** Test-only reset hook — clears all warn-once dedup state. */
30
+ export declare function resetWarnOnce(): void;
31
+ /**
32
+ * Resolve a manifest/CLI `preset` value to the {@link VendorPreset} it names
33
+ * (UX finding M48).
34
+ *
35
+ * - Unset (`undefined`): defaults to `dtrpg` for backward compatibility —
36
+ * flipping the silent default to the new neutral `book` preset would change
37
+ * output geometry (trim size, TAC cap, PDF/X forcing) for every existing
38
+ * preset-less project. Emits a one-line warning instead so authors notice
39
+ * and choose explicitly; a future major version may change the default.
40
+ * - Unknown (typo'd) value: throws a {@link UsageError} naming the known
41
+ * presets, instead of silently falling back to `dtrpg` — the previous
42
+ * behavior turned a typo'd `preset: a4` into 621x810pt DriveThruRPG
43
+ * geometry with TAC 240 and PDF/X x1a with zero feedback.
44
+ */
45
+ export declare function resolvePreset(presetName: string | undefined): VendorPreset;
@@ -0,0 +1,17 @@
1
+ export declare const ruleRemoteUrls = "printsafe/no-remote-urls";
2
+ export declare const ruleRiskyProps = "printsafe/no-risky-print-effects";
3
+ export declare const rulePagedjsCrashSelectors = "printsafe/no-pagedjs-crash-selectors";
4
+ export declare const ruleSyntax = "printsafe/syntax-error";
5
+ export interface PrintSafeWarning {
6
+ rule: string;
7
+ severity: "error" | "warning";
8
+ message: string;
9
+ line: number;
10
+ column: number;
11
+ }
12
+ /**
13
+ * Run print-safety checks against a CSS string. Returns one warning per finding
14
+ * (errors for remote URLs / crash-prone selectors / syntax errors; warnings for
15
+ * risky print effects).
16
+ */
17
+ export declare function checkCss(css: string, from?: string): PrintSafeWarning[];
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Which embedded starter template to scaffold from. Each id maps to a directory
3
+ * under `assets/templates/<id>/` (a `manifest.yaml` + a `chapter-01.md`), baked
4
+ * into the binary via `embedded-assets.ts`. `"book"` is the default; the others
5
+ * give non-technical authors a head start for common formats (#29).
6
+ */
7
+ export type ProjectTemplateId = "book" | "ttrpg" | "zine" | "technical";
8
+ /**
9
+ * How (or whether) to put the new project under local version history.
10
+ *
11
+ * - `"local-git"` — default. Initialise a local Git repo with one initial
12
+ * "snapshot" commit, using a **Node-native, pure-JS** implementation
13
+ * (`isomorphic-git`) per CLAUDE.md §7. No remote, no credentials. Maps to a
14
+ * `local-git-folder` ProjectSource.
15
+ * - `"none"` — the escape hatch. Leave the project a plain `local-folder` (no
16
+ * `.git`). Selected automatically if version-history init fails, or
17
+ * explicitly by an author who does not want it.
18
+ */
19
+ export type ProjectVersionHistoryMode = "local-git" | "none";
20
+ /**
21
+ * Inputs the wizard / CLI collect from the author. Writer-friendly: the only
22
+ * required field is a human project name; everything else is derived or
23
+ * defaulted.
24
+ */
25
+ export interface CreateProjectOptions {
26
+ /** Human-friendly project name (e.g. "My First Book"). Required. */
27
+ name: string;
28
+ /** Author display name. Becomes manifest `authors: [author]`. Optional. */
29
+ author?: string;
30
+ /** Absolute path to the PARENT directory chosen in the folder picker. */
31
+ parentDir: string;
32
+ /** Folder name under `parentDir`. Defaults to a slug of `name`. */
33
+ folderName?: string;
34
+ /** Which embedded template to scaffold from. Defaults to `"book"`. */
35
+ template?: ProjectTemplateId;
36
+ /**
37
+ * Absolute path to a CUSTOM template directory to scaffold from (#29). When
38
+ * set, the whole directory is copied (minus its metadata sidecar) instead of a
39
+ * built-in template, and `template` is ignored. Used by the wizard when the
40
+ * author picks a saved/imported template.
41
+ */
42
+ templateDir?: string;
43
+ /** Version-history mode for the new project. Defaults to `"local-git"`. */
44
+ versionHistory?: ProjectVersionHistoryMode;
45
+ }
46
+ /** The result of a successful scaffold. */
47
+ export interface CreateProjectResult {
48
+ /** Absolute path of the created project directory. */
49
+ projectDir: string;
50
+ /** Absolute path of the generated manifest. */
51
+ manifestPath: string;
52
+ /**
53
+ * Absolute path of the sample chapter the desktop should open first, so the
54
+ * author immediately sees a rendered document (issue acceptance criterion).
55
+ */
56
+ openFile: string;
57
+ /**
58
+ * What actually happened with version history. May differ from the requested
59
+ * mode: if `"local-git"` was requested but init failed (escape hatch fired),
60
+ * this is `"none"` and `versionHistoryError` explains why.
61
+ */
62
+ versionHistory: ProjectVersionHistoryMode;
63
+ /** Present only when `"local-git"` was requested but downgraded to `"none"`. */
64
+ versionHistoryError?: string;
65
+ }
66
+ /**
67
+ * Discriminated failure reasons so the wizard can show a writer-friendly
68
+ * message and the CLI can choose an exit code. Scaffolding is fail-fast and
69
+ * NEVER deletes or overwrites anything that already exists.
70
+ */
71
+ export type CreateProjectErrorCode = "parent-not-writable" | "target-exists" | "invalid-name" | "scaffold-io";
72
+ export interface CreateProjectError extends Error {
73
+ code: CreateProjectErrorCode;
74
+ }
75
+ /**
76
+ * Slugify a human name into a safe folder / filename stem: lowercased,
77
+ * non-alphanumerics collapsed to single hyphens, trimmed. Returns `""` for
78
+ * input that contains no usable characters (caller treats that as invalid).
79
+ */
80
+ export declare function slugifyProjectName(name: string): string;
81
+ /**
82
+ * Escape a string for use as a double-quoted YAML scalar. We emit values inside
83
+ * `"..."`, so only `\` and `"` need escaping. Keeps the generated manifest
84
+ * human-readable while staying valid for any author name/title.
85
+ */
86
+ export declare function escapeYamlScalar(value: string): string;
87
+ /**
88
+ * Scaffold a new gutterpress project. Resolves with a {@link CreateProjectResult};
89
+ * throws a {@link CreateProjectError} on any precondition failure.
90
+ */
91
+ export declare function scaffoldProject(options: CreateProjectOptions): Promise<CreateProjectResult>;
92
+ /** Options for adopting an EXISTING folder as a gutterpress project (in place). */
93
+ export interface AdoptFolderOptions {
94
+ /** Absolute path of the existing folder to set up as a book. */
95
+ dir: string;
96
+ /** Book title. Defaults to a prettified version of the folder name. */
97
+ title?: string;
98
+ /** Author display name. Optional. */
99
+ author?: string;
100
+ /** Template whose starter theme/chapter is used. Defaults to `"book"`. */
101
+ template?: ProjectTemplateId;
102
+ /** Version-history mode. Defaults to `"local-git"`. */
103
+ versionHistory?: ProjectVersionHistoryMode;
104
+ }
105
+ /**
106
+ * Adopt an EXISTING folder as a gutterpress project, in place (no new subfolder).
107
+ * Writes a `manifest.yaml` (using the folder's existing top-level `.md` files as
108
+ * `source.files`, or scaffolding a `chapter-01.md` when there are none), copies
109
+ * a starter `styles/book.css`, ensures `dist/` is gitignored (see
110
+ * `ensureGitignoreHasDist`), and optionally initialises local version history.
111
+ *
112
+ * NON-DESTRUCTIVE (global never-overwrite rule): refuses if the folder is
113
+ * already a project, and never overwrites an existing `manifest.yaml`,
114
+ * `styles/book.css`, `.gitignore`, or any markdown file.
115
+ */
116
+ export declare function adoptFolder(options: AdoptFolderOptions): Promise<CreateProjectResult>;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * The classified source of an opened project.
3
+ *
4
+ * `managed-github` is defined for #15/#16 (OAuth-backed GitHub projects) but is
5
+ * never produced by {@link detectProjectSource} in this release.
6
+ */
7
+ export type ProjectSource = {
8
+ type: "local-folder";
9
+ path: string;
10
+ } | {
11
+ type: "local-git-folder";
12
+ path: string;
13
+ /**
14
+ * Root of the Git repository that holds this project's history. For a
15
+ * project that IS the repository root this equals `path`. For a book
16
+ * folder that lives INSIDE a larger repository (a multi-book monorepo)
17
+ * this is the enclosing repository root — the project USES that repo's
18
+ * history, scoped to its own subfolder, rather than being told to move.
19
+ */
20
+ repoRoot: string;
21
+ /**
22
+ * Project directory relative to `repoRoot`, in canonical forward-slash
23
+ * form (`"books/field-guide"`). Empty string when the project is the
24
+ * repository root itself. Records WHERE the opened folder sits inside
25
+ * the repo — it does not scope anything: history/snapshot/restore/sync
26
+ * operate on the whole repo at `repoRoot` ("a project is its git repo"),
27
+ * never on just this subfolder.
28
+ */
29
+ subPath: string;
30
+ hasRemote: boolean;
31
+ remoteUrl?: string;
32
+ branch?: string;
33
+ } | {
34
+ type: "managed-github";
35
+ owner: string;
36
+ repo: string;
37
+ branch: string;
38
+ rootPath?: string;
39
+ };
40
+ /**
41
+ * What the UI may offer for a given source. Derived purely from the source
42
+ * type; no I/O.
43
+ *
44
+ * NOTE (audit D5): today the desktop only reads `canSnapshot` (it gates the
45
+ * StatusBar "Version history" affordance). The other flags —
46
+ * `canEnableVersionHistory`, `canViewHistory`, `canRestoreSnapshot`, `canRead`,
47
+ * `canWriteLocal`, `authManagedByApp` — are computed and part of the DTO but
48
+ * not yet wired to UI gating; they are staging for the version-history feature
49
+ * (#13). Don't assume a button is driven by one of these until you find its
50
+ * reader.
51
+ *
52
+ * Deliberately NO `canSync` here: syncability is a credential-aware question
53
+ * only `diagnoseProjectRemote().canSync` (remote-auth/diagnose.ts) can answer.
54
+ * This interface used to carry a second, weaker `canSync` (= hasRemote, any
55
+ * protocol, no credential check), and the two same-named-but-different gates
56
+ * were a recurring source of contradictory sync behavior. Remote PRESENCE, for
57
+ * display purposes, lives on the classification itself (`source.hasRemote`).
58
+ */
59
+ export interface ProjectCapabilities {
60
+ canRead: boolean;
61
+ canWriteLocal: boolean;
62
+ canEnableVersionHistory: boolean;
63
+ canSnapshot: boolean;
64
+ canViewHistory: boolean;
65
+ canRestoreSnapshot: boolean;
66
+ authManagedByApp: boolean;
67
+ }
68
+ /**
69
+ * The remote a project syncs against: `origin` when one exists, else the first
70
+ * remote. Pure pick over a `listRemotes` result — see {@link syncRemoteFor}
71
+ * for the I/O helper detection and the sync transport share.
72
+ */
73
+ export declare function pickSyncRemote<T extends {
74
+ remote: string;
75
+ url?: string;
76
+ }>(remotes: T[]): T | undefined;
77
+ /**
78
+ * THE one answer to "which remote does this repo sync against, and what's its
79
+ * URL" — shared by detection (`detectProjectSource`) and the sync transport
80
+ * (`resolveTransport`), so the two layers can never disagree about whether a
81
+ * remote exists (each divergence shipped as a repo the engine could sync that
82
+ * the UI called local-only, or vice versa).
83
+ *
84
+ * `listRemotes` scans `[remote "…"]` sections case-SENSITIVELY, but git itself
85
+ * (and isomorphic-git's own fetch/push, via config `get`) treats section names
86
+ * case-INSENSITIVELY — so a hand-edited `[Remote "origin"]` IS syncable by the
87
+ * engine while being invisible to `listRemotes`. The `getConfig` fallback
88
+ * covers exactly that: it uses the same case-insensitive, last-value-wins
89
+ * lookup the engine's transport uses. Never throws.
90
+ */
91
+ export declare function syncRemoteFor(dir: string): Promise<{
92
+ remote: string;
93
+ url: string;
94
+ } | undefined>;
95
+ /**
96
+ * Walk PARENT directories of `folderPath` looking for a `.git` directory
97
+ * (the folder's own `.git` is the `local-git-folder` case, not this).
98
+ * Returns the nearest enclosing repo root, or `undefined` when none exists.
99
+ *
100
+ * Stops at the user's home directory — a repo AT or ABOVE `~` is OS/system
101
+ * tooling (e.g. a dotfiles repo), not the author's project, and must never
102
+ * become the `repoRoot` for a bare folder the author opens under home (that
103
+ * would scope snapshot/restore/sync to the entire home directory). The home
104
+ * check runs BEFORE the `.git` probe on each ancestor so home itself is never
105
+ * treated as an enclosing repo, even if it happens to have a `.git` dir.
106
+ * Pure `node:fs` stats — no git involvement — so the walk costs one `stat`
107
+ * per ancestor.
108
+ */
109
+ export declare function findEnclosingRepoDir(folderPath: string): Promise<string | undefined>;
110
+ /** Project dir relative to the repo root, canonical forward-slash form. */
111
+ export declare function repoSubPath(repoRoot: string, folderPath: string): string;
112
+ /**
113
+ * Classify a folder by inspecting it for a `.git` directory and, if present,
114
+ * reading `.git/config` (for a remote) and `.git/HEAD` (for the branch).
115
+ *
116
+ * A folder WITHOUT its own `.git` that sits inside an enclosing repository
117
+ * (a book subfolder of a multi-book monorepo) classifies as
118
+ * `local-git-folder` too: it USES the enclosing repo's history, scoped to
119
+ * `subPath`. Only a folder with no repo anywhere above it is `local-folder`.
120
+ *
121
+ * Pure Node-fs logic; never throws — any read error degrades gracefully (a
122
+ * `.git` dir that can't be parsed still classifies as `local-git-folder` with
123
+ * `hasRemote: false`). Never returns `managed-github`.
124
+ */
125
+ export declare function detectProjectSource(folderPath: string): Promise<ProjectSource>;
126
+ /**
127
+ * Map a {@link ProjectSource} to the actions the UI may offer. Pure; no I/O.
128
+ *
129
+ * - `local-folder`: read/write only; version history can be ENABLED (a later
130
+ * `git init`, #13/#25) but no snapshot/history/restore until then.
131
+ * - `local-git-folder`: version history already on, so snapshot/history/restore
132
+ * are available — including book subfolders of a larger repo (`subPath`
133
+ * non-empty), which share the enclosing repo's whole-repo history (`subPath`
134
+ * is where the folder sits, not a scope).
135
+ * - `managed-github`: full app-managed read/write/version history.
136
+ *
137
+ * Syncability is deliberately NOT answered here — see the interface doc
138
+ * comment: `diagnoseProjectRemote().canSync` is the one sync gate.
139
+ */
140
+ export declare function capabilitiesFor(source: ProjectSource): ProjectCapabilities;
@@ -0,0 +1,49 @@
1
+ /** The built-in templates shipped as embedded assets. */
2
+ export declare const BUILT_IN_TEMPLATE_IDS: readonly ["book", "ttrpg", "zine", "technical"];
3
+ /** Author-friendly metadata for one template (built-in or custom). */
4
+ export interface TemplateInfo {
5
+ /** Stable id. For built-ins, the {@link ProjectTemplateId}; for custom, a slug. */
6
+ id: string;
7
+ /** Display name shown in the wizard. */
8
+ label: string;
9
+ /** One-line description shown under the label. */
10
+ description: string;
11
+ /** `"builtin"` (embedded) or `"custom"` (user-saved / imported). */
12
+ kind: "builtin" | "custom";
13
+ /** For custom templates: absolute directory the files live in. */
14
+ dir?: string;
15
+ }
16
+ /** List the built-in templates (metadata only — no fs access). */
17
+ export declare function listBuiltInTemplates(): Promise<TemplateInfo[]>;
18
+ export interface SaveProjectAsTemplateOptions {
19
+ /** Absolute path of the project to capture. */
20
+ projectDir: string;
21
+ /** Author-supplied template name. */
22
+ name: string;
23
+ /** Absolute directory custom templates are stored under. */
24
+ templatesRoot: string;
25
+ }
26
+ /**
27
+ * Capture an existing project as a reusable custom template. Copies the whole
28
+ * project tree (minus build/VCS dirs) into `<templatesRoot>/<slug(name)>/`, then
29
+ * re-tokenises the project's title back to `{{TITLE}}` in the manifest so the
30
+ * saved template scaffolds cleanly for the next book. Refuses to overwrite an
31
+ * existing template directory (never deletes user data).
32
+ */
33
+ export declare function saveProjectAsTemplate(options: SaveProjectAsTemplateOptions): Promise<TemplateInfo>;
34
+ /**
35
+ * List custom templates saved under `templatesRoot`. Returns `[]` when the root
36
+ * doesn't exist. Each subdirectory is a template; its label comes from the
37
+ * metadata sidecar (falling back to a prettified id).
38
+ */
39
+ export declare function listCustomTemplates(templatesRoot: string): Promise<TemplateInfo[]>;
40
+ /**
41
+ * Import a template from an arbitrary folder by copying it under `templatesRoot`.
42
+ * Thin wrapper around the same copy logic as save-as-template, used by the
43
+ * wizard's "Import template…" action. Refuses to overwrite an existing id.
44
+ */
45
+ export declare function importTemplateFromFolder(options: {
46
+ sourceDir: string;
47
+ name?: string;
48
+ templatesRoot: string;
49
+ }): Promise<TemplateInfo>;
@@ -0,0 +1,10 @@
1
+ import type { PublishDeps } from "./types.ts";
2
+ /** broth channel for the running platform; null when unsupported. */
3
+ export declare function butlerBrothChannel(platform?: NodeJS.Platform, arch?: string): string | null;
4
+ export declare function butlerDownloadUrl(channel: string): string;
5
+ /**
6
+ * Resolve a runnable butler command, downloading it into the tool cache when
7
+ * necessary. Returns the command to spawn (an absolute path, or plain
8
+ * "butler" when found on the PATH).
9
+ */
10
+ export declare function ensureButler(deps: PublishDeps): Promise<string>;
@@ -0,0 +1,18 @@
1
+ import type { CommandRunner } from "./types.ts";
2
+ /**
3
+ * Default idle budget (audit B2 / review): applied BY THE RUNNER whenever
4
+ * `timeoutMs` is omitted, so no call site (a provider upload, a
5
+ * `commandExists` probe) can silently regain hang-forever behavior by
6
+ * forgetting to pass it. `timeoutMs: 0` is the explicit opt-out. Idle, not
7
+ * total — the timer re-arms on every output chunk, so only total silence
8
+ * kills the child. 5 minutes tolerates upload CLIs that quiet their progress
9
+ * stream when piped (butler/swa run with stdio piped, not a TTY).
10
+ */
11
+ export declare const PUBLISH_IDLE_TIMEOUT_MS = 300000;
12
+ export declare const defaultCommandRunner: CommandRunner;
13
+ /**
14
+ * True when `cmd` resolves to an executable on the PATH. `env` (typically
15
+ * {@link PublishDeps.env}) is forwarded to the probe so a host-injected PATH
16
+ * influences resolution the same way it will influence the eventual spawn.
17
+ */
18
+ export declare function commandExists(cmd: string, runCommand?: CommandRunner, env?: Record<string, string | undefined>): Promise<boolean>;
@@ -0,0 +1,23 @@
1
+ import { type PublishDeps } from "./types.ts";
2
+ export interface ConnectPublishProviderOptions {
3
+ projectDir: string;
4
+ providerId: string;
5
+ /** The pasted API key. NEVER log this. */
6
+ token: string;
7
+ /**
8
+ * Optional account label for a NAMED credential — lets a user keep several
9
+ * credentials for one provider (e.g. two itch.io accounts). Stored under the
10
+ * compound `<host>#<account>` key; empty means the default (bare-host) entry.
11
+ */
12
+ account?: string;
13
+ manifestPath?: string;
14
+ }
15
+ /**
16
+ * Verify `token` with the platform, then store it. Throws a friendly,
17
+ * token-free error when the provider needs no key, the paste is empty, or
18
+ * the platform rejects it — leaving the store untouched in every case.
19
+ */
20
+ export declare function connectPublishProvider(options: ConnectPublishProviderOptions, deps: PublishDeps): Promise<{
21
+ connected: true;
22
+ providerId: string;
23
+ }>;
@@ -0,0 +1,9 @@
1
+ /** All `publish.*` sections, as plain JSON keyed by provider id (absent → {}). */
2
+ export declare function readPublishSettings(projectDir: string): Promise<Record<string, Record<string, unknown>>>;
3
+ /**
4
+ * Merge `values` into `publish.<providerId>`. A value of `undefined`, `null`
5
+ * or `""` deletes that key; emptied sections (and an emptied `publish:` map)
6
+ * are removed rather than left dangling. Returns the updated settings straight
7
+ * from the in-memory document — no re-read.
8
+ */
9
+ export declare function setPublishProviderConfig(projectDir: string, providerId: string, values: Record<string, unknown>): Promise<Record<string, Record<string, unknown>>>;
@@ -0,0 +1,3 @@
1
+ import { type PublishProvider } from "../types.ts";
2
+ export declare const AZURE_SWA_HOST = "azure-swa";
3
+ export declare const azureSwaProvider: PublishProvider;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * DriveThruRPG publish provider (#35) — GUIDED.
3
+ *
4
+ * DriveThruRPG has no publisher upload API (its public API is read-only,
5
+ * customer-side). Publishing stages a validated upload package and opens the
6
+ * publisher hub with a checklist. If DTRPG ever ships a publisher API this
7
+ * provider upgrades to kind "api" without changing the author surface.
8
+ */
9
+ import type { PublishProvider } from "../types.ts";
10
+ export declare const drivethrurpgProvider: PublishProvider;
@@ -0,0 +1,3 @@
1
+ import type { PublishRequest } from "../types.ts";
2
+ /** Copy the artifact + a LISTING.md metadata sheet into the staging dir. */
3
+ export declare function stageGuidedPackage(req: PublishRequest, providerId: string, listingLines: string[]): Promise<string>;
@@ -0,0 +1,5 @@
1
+ import { type PublishProvider } from "../types.ts";
2
+ export declare const ITCH_HOST = "itch.io";
3
+ /** `user/game` → the public project page URL. */
4
+ export declare function itchProjectUrl(target: string): string;
5
+ export declare const itchProvider: PublishProvider;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Amazon KDP publish provider (#35) — GUIDED.
3
+ *
4
+ * Amazon has no KDP API and has stated no plans to release one; scripting the
5
+ * KDP web UI violates its ToS. Publishing stages a KDP-ready package
6
+ * (interior PDF + listing sheet) and opens the KDP bookshelf with a checklist.
7
+ */
8
+ import type { PublishProvider } from "../types.ts";
9
+ export declare const kdpProvider: PublishProvider;
@@ -0,0 +1,5 @@
1
+ import { type PublishProvider } from "../types.ts";
2
+ export declare const SHOPIFY_HOST = "shopify";
3
+ /** `gid://shopify/Product/123` → `123` (for admin deep links). */
4
+ export declare function shopifyLegacyId(gid: string): string;
5
+ export declare const shopifyProvider: PublishProvider;
@@ -0,0 +1,5 @@
1
+ import type { PublishProvider, PublishProviderInfo } from "./types.ts";
2
+ /** All providers' static descriptions, in display order. */
3
+ export declare function listPublishProviders(): PublishProviderInfo[];
4
+ /** Look up a provider by id; throws a friendly error listing valid ids. */
5
+ export declare function publishProviderFor(id: string): PublishProvider;
@@ -0,0 +1,30 @@
1
+ import type { PreflightIssue, PublishDeps, PublishOutcome, PublishRequest } from "./types.ts";
2
+ export interface RunPublishOptions {
3
+ projectDir: string;
4
+ providerId: string;
5
+ manifestPath?: string;
6
+ /**
7
+ * Explicit artifact path (a PDF file, or the HTML export directory).
8
+ * Default: the manifest's resolved output location.
9
+ */
10
+ artifactPath?: string;
11
+ /** Stop after preflight — report issues without contacting the platform. */
12
+ dryRun?: boolean;
13
+ }
14
+ export interface RunPublishResult {
15
+ ok: boolean;
16
+ providerId: string;
17
+ issues: PreflightIssue[];
18
+ /** Present when the upload ran (not on dry runs / preflight failures). */
19
+ outcome?: PublishOutcome;
20
+ /** Friendly failure summary when `ok` is false. */
21
+ error?: string;
22
+ }
23
+ /**
24
+ * Resolve the {@link PublishRequest} for a provider from the project's
25
+ * manifest — shared by `runPublish` and by hosts that call individual
26
+ * provider methods (authenticate, listProducts) outside a full publish.
27
+ */
28
+ export declare function resolvePublishRequest(options: Pick<RunPublishOptions, "projectDir" | "providerId" | "manifestPath" | "artifactPath">, deps: PublishDeps): Promise<PublishRequest>;
29
+ /** Preflight → authenticate → upload, with structured results throughout. */
30
+ export declare function runPublish(options: RunPublishOptions, deps: PublishDeps): Promise<RunPublishResult>;
@@ -0,0 +1,25 @@
1
+ /** Both levels' explicit selections for a provider (for the UI). */
2
+ export interface PublishAccountSelection {
3
+ project?: string;
4
+ global?: string;
5
+ }
6
+ export declare class PublishSelectionsStore {
7
+ readonly filePath: string;
8
+ private queue;
9
+ constructor(filePath?: string);
10
+ private read;
11
+ private write;
12
+ private enqueue;
13
+ /**
14
+ * The effective default account for a provider: the project selection wins
15
+ * over the global one; `undefined` when neither is set (→ the default
16
+ * bare-host credential).
17
+ */
18
+ resolve(providerId: string, projectDir?: string): Promise<string | undefined>;
19
+ /** Both explicit selections for a provider — for a UI that shows each level. */
20
+ levels(providerId: string, projectDir?: string): Promise<PublishAccountSelection>;
21
+ /** Set (or clear, with an empty account) the global default for a provider. */
22
+ setGlobal(providerId: string, account: string | null): Promise<void>;
23
+ /** Set (or clear) the default for one provider within one project. */
24
+ setProject(projectDir: string, providerId: string, account: string | null): Promise<void>;
25
+ }