@thegetty/quire-cli 1.0.0-rc.44 → 1.0.0-rc.46

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 (243) hide show
  1. package/CHANGELOG.md +0 -36
  2. package/README.md +0 -9
  3. package/bin/cli.js +1 -46
  4. package/package.json +9 -25
  5. package/src/Command.js +6 -26
  6. package/src/commands/README.md +122 -213
  7. package/src/commands/build.js +37 -45
  8. package/src/commands/clean.js +19 -33
  9. package/src/commands/conf.js +43 -0
  10. package/src/commands/create.js +14 -42
  11. package/src/commands/epub.js +31 -67
  12. package/src/commands/index.js +2 -9
  13. package/src/commands/info.js +86 -88
  14. package/src/commands/pdf.js +82 -63
  15. package/src/commands/preview.js +31 -32
  16. package/src/commands/validate.js +20 -64
  17. package/src/commands/version.js +43 -0
  18. package/src/errors/validation/validation-error.js +11 -20
  19. package/src/helpers/clean.js +1 -1
  20. package/src/helpers/is-quire.js +31 -0
  21. package/src/helpers/test-cwd.js +6 -5
  22. package/src/helpers/which.js +4 -10
  23. package/src/lib/11ty/README.md +19 -135
  24. package/src/lib/11ty/api.js +93 -235
  25. package/src/lib/11ty/cli.js +37 -112
  26. package/src/lib/11ty/index.js +5 -64
  27. package/src/lib/11ty/paths.js +103 -0
  28. package/src/lib/README.md +0 -330
  29. package/src/lib/conf/README.md +69 -86
  30. package/src/lib/conf/config.js +3 -5
  31. package/src/lib/conf/defaults.js +0 -65
  32. package/src/lib/conf/schema.js +9 -103
  33. package/src/lib/epub/README.md +2 -133
  34. package/src/lib/epub/epub.js +11 -36
  35. package/src/lib/epub/index.js +21 -111
  36. package/src/lib/epub/pandoc.js +4 -33
  37. package/src/lib/git/README.md +2 -151
  38. package/src/lib/git/index.js +13 -217
  39. package/src/lib/i18n/README.md +3 -0
  40. package/src/lib/i18n/config.js +53 -0
  41. package/src/lib/i18n/index.js +43 -0
  42. package/src/lib/i18n/localeService.js +58 -0
  43. package/src/lib/pdf/README.md +0 -131
  44. package/src/lib/pdf/index.js +21 -124
  45. package/src/lib/pdf/paged.js +52 -100
  46. package/src/lib/pdf/prince.js +37 -115
  47. package/src/lib/pdf/split.js +33 -61
  48. package/src/lib/quire/README.md +19 -0
  49. package/src/lib/quire/index.js +353 -0
  50. package/src/lib/reporter/README.md +2 -211
  51. package/src/lib/reporter/index.js +0 -607
  52. package/src/main.js +48 -221
  53. package/src/packageConfig.js +0 -17
  54. package/src/validators/utils.js +1 -2
  55. package/schemas/config.schema.json +0 -194
  56. package/schemas/figures.schema.json +0 -56
  57. package/schemas/layout.schema.json +0 -5
  58. package/schemas/objects.schema.json +0 -62
  59. package/schemas/publication.schema.json +0 -140
  60. package/schemas/references.schema.json +0 -29
  61. package/src/Command.spec.js +0 -99
  62. package/src/commands/build.spec.js +0 -113
  63. package/src/commands/build.test.js +0 -397
  64. package/src/commands/clean.spec.js +0 -118
  65. package/src/commands/clean.test.js +0 -382
  66. package/src/commands/config.js +0 -238
  67. package/src/commands/config.spec.js +0 -107
  68. package/src/commands/config.test.js +0 -845
  69. package/src/commands/create.spec.js +0 -112
  70. package/src/commands/create.test.js +0 -415
  71. package/src/commands/doctor.js +0 -251
  72. package/src/commands/doctor.spec.js +0 -115
  73. package/src/commands/doctor.test.js +0 -1409
  74. package/src/commands/epub.spec.js +0 -114
  75. package/src/commands/epub.test.js +0 -503
  76. package/src/commands/help.js +0 -60
  77. package/src/commands/help.test.js +0 -132
  78. package/src/commands/info.spec.js +0 -72
  79. package/src/commands/info.test.js +0 -512
  80. package/src/commands/pdf.spec.js +0 -114
  81. package/src/commands/pdf.test.js +0 -464
  82. package/src/commands/preview.spec.js +0 -97
  83. package/src/commands/preview.test.js +0 -250
  84. package/src/commands/use.js +0 -56
  85. package/src/commands/use.spec.js +0 -61
  86. package/src/commands/use.test.js +0 -280
  87. package/src/commands/validate.spec.js +0 -90
  88. package/src/commands/validate.test.js +0 -378
  89. package/src/commands/workflows.js +0 -70
  90. package/src/errors/build/build-failed-error.js +0 -19
  91. package/src/errors/build/config-field-missing-error.js +0 -20
  92. package/src/errors/build/config-file-not-found-error.js +0 -20
  93. package/src/errors/build/index.js +0 -11
  94. package/src/errors/help/help-topic-not-found-error.js +0 -30
  95. package/src/errors/help/index.js +0 -8
  96. package/src/errors/index.js +0 -58
  97. package/src/errors/input/index.js +0 -8
  98. package/src/errors/input/invalid-input-error.js +0 -21
  99. package/src/errors/install/dependency-install-error.js +0 -19
  100. package/src/errors/install/directory-not-empty-error.js +0 -25
  101. package/src/errors/install/index.js +0 -12
  102. package/src/errors/install/invalid-path-error.js +0 -31
  103. package/src/errors/install/invalid-starter-error.js +0 -27
  104. package/src/errors/install/version-not-found-error.js +0 -35
  105. package/src/errors/output/epub-generation-error.js +0 -19
  106. package/src/errors/output/index.js +0 -14
  107. package/src/errors/output/invalid-epub-library-error.js +0 -20
  108. package/src/errors/output/invalid-pdf-library-error.js +0 -20
  109. package/src/errors/output/missing-build-output-error.js +0 -21
  110. package/src/errors/output/pdf-generation-error.js +0 -24
  111. package/src/errors/output/tool-not-found-error.js +0 -37
  112. package/src/errors/project/index.js +0 -10
  113. package/src/errors/project/not-in-project-error.js +0 -20
  114. package/src/errors/project/project-create-error.js +0 -21
  115. package/src/errors/quire-error.js +0 -27
  116. package/src/errors/validation/index.js +0 -3
  117. package/src/errors/validation/unknown-config-key-error.js +0 -27
  118. package/src/errors/validation/unknown-config-operation-error.js +0 -24
  119. package/src/helpers/docs-url.js +0 -32
  120. package/src/helpers/pager.js +0 -59
  121. package/src/helpers/pager.test.js +0 -85
  122. package/src/helpers/suggest-similar.js +0 -124
  123. package/src/helpers/suggest-similar.test.js +0 -108
  124. package/src/helpers/test-cwd.test.js +0 -192
  125. package/src/lib/11ty/index.test.js +0 -655
  126. package/src/lib/commander/index.js +0 -103
  127. package/src/lib/commander/index.test.js +0 -86
  128. package/src/lib/commander/options.js +0 -237
  129. package/src/lib/commander/options.test.js +0 -205
  130. package/src/lib/conf/build-status.js +0 -103
  131. package/src/lib/conf/build-status.test.js +0 -247
  132. package/src/lib/conf/config.test.js +0 -281
  133. package/src/lib/conf/format.js +0 -60
  134. package/src/lib/conf/format.test.js +0 -106
  135. package/src/lib/conf/helpers.js +0 -91
  136. package/src/lib/conf/helpers.test.js +0 -136
  137. package/src/lib/conf/index.js +0 -22
  138. package/src/lib/constants.js +0 -28
  139. package/src/lib/doctor/README.md +0 -667
  140. package/src/lib/doctor/checks/environment/cli-version.js +0 -62
  141. package/src/lib/doctor/checks/environment/cli-version.test.js +0 -132
  142. package/src/lib/doctor/checks/environment/git-available.js +0 -77
  143. package/src/lib/doctor/checks/environment/git-available.test.js +0 -52
  144. package/src/lib/doctor/checks/environment/index.js +0 -13
  145. package/src/lib/doctor/checks/environment/node-version.js +0 -66
  146. package/src/lib/doctor/checks/environment/node-version.test.js +0 -17
  147. package/src/lib/doctor/checks/environment/npm-available.js +0 -66
  148. package/src/lib/doctor/checks/environment/npm-available.test.js +0 -52
  149. package/src/lib/doctor/checks/environment/os-info.js +0 -48
  150. package/src/lib/doctor/checks/environment/os-info.test.js +0 -81
  151. package/src/lib/doctor/checks/environment/runtime-info.js +0 -51
  152. package/src/lib/doctor/checks/environment/runtime-info.test.js +0 -132
  153. package/src/lib/doctor/checks/outputs/epub-output.js +0 -119
  154. package/src/lib/doctor/checks/outputs/epub-output.test.js +0 -277
  155. package/src/lib/doctor/checks/outputs/index.js +0 -10
  156. package/src/lib/doctor/checks/outputs/pdf-output.js +0 -144
  157. package/src/lib/doctor/checks/outputs/pdf-output.test.js +0 -377
  158. package/src/lib/doctor/checks/outputs/stale-build.js +0 -122
  159. package/src/lib/doctor/checks/outputs/stale-build.test.js +0 -282
  160. package/src/lib/doctor/checks/project/data-files.js +0 -56
  161. package/src/lib/doctor/checks/project/data-files.test.js +0 -125
  162. package/src/lib/doctor/checks/project/dependencies.js +0 -53
  163. package/src/lib/doctor/checks/project/dependencies.test.js +0 -71
  164. package/src/lib/doctor/checks/project/index.js +0 -11
  165. package/src/lib/doctor/checks/project/quire-11ty.js +0 -98
  166. package/src/lib/doctor/checks/project/quire-11ty.test.js +0 -170
  167. package/src/lib/doctor/checks/project/quire-project.js +0 -38
  168. package/src/lib/doctor/checks/project/quire-project.test.js +0 -47
  169. package/src/lib/doctor/checks/tools/index.js +0 -10
  170. package/src/lib/doctor/checks/tools/pandoc-available.js +0 -82
  171. package/src/lib/doctor/checks/tools/pandoc-available.test.js +0 -73
  172. package/src/lib/doctor/checks/tools/prince-available.js +0 -81
  173. package/src/lib/doctor/checks/tools/prince-available.test.js +0 -73
  174. package/src/lib/doctor/constants.js +0 -39
  175. package/src/lib/doctor/formatDuration.js +0 -108
  176. package/src/lib/doctor/formatDuration.test.js +0 -76
  177. package/src/lib/doctor/formatters/human.js +0 -257
  178. package/src/lib/doctor/formatters/human.test.js +0 -463
  179. package/src/lib/doctor/formatters/index.js +0 -8
  180. package/src/lib/doctor/formatters/json.js +0 -78
  181. package/src/lib/doctor/formatters/json.test.js +0 -174
  182. package/src/lib/doctor/formatters/shared.js +0 -129
  183. package/src/lib/doctor/formatters/shared.test.js +0 -194
  184. package/src/lib/doctor/index.js +0 -271
  185. package/src/lib/doctor/index.test.js +0 -797
  186. package/src/lib/epub/engines.js +0 -46
  187. package/src/lib/epub/index.test.js +0 -518
  188. package/src/lib/epub/pandoc.test.js +0 -122
  189. package/src/lib/epub/schema.js +0 -21
  190. package/src/lib/error/README.md +0 -170
  191. package/src/lib/error/handler.js +0 -107
  192. package/src/lib/git/index.spec.js +0 -80
  193. package/src/lib/git/index.test.js +0 -453
  194. package/src/lib/help/frontmatter.js +0 -77
  195. package/src/lib/help/frontmatter.test.js +0 -139
  196. package/src/lib/help/index.js +0 -146
  197. package/src/lib/help/index.test.js +0 -188
  198. package/src/lib/help/topics/configuration.md +0 -77
  199. package/src/lib/help/topics/debugging.md +0 -69
  200. package/src/lib/help/topics/epub.md +0 -74
  201. package/src/lib/help/topics/pdf.md +0 -74
  202. package/src/lib/help/topics/publishing.md +0 -80
  203. package/src/lib/help/topics/workflows.md +0 -50
  204. package/src/lib/installer/index.js +0 -309
  205. package/src/lib/installer/index.spec.js +0 -83
  206. package/src/lib/installer/index.test.js +0 -545
  207. package/src/lib/logger/README.md +0 -424
  208. package/src/lib/logger/debug.js +0 -132
  209. package/src/lib/logger/debug.spec.js +0 -130
  210. package/src/lib/logger/debug.test.js +0 -128
  211. package/src/lib/logger/index.js +0 -228
  212. package/src/lib/logger/index.spec.js +0 -131
  213. package/src/lib/logger/index.test.js +0 -578
  214. package/src/lib/npm/README.md +0 -127
  215. package/src/lib/npm/index.js +0 -198
  216. package/src/lib/npm/index.spec.js +0 -60
  217. package/src/lib/npm/index.test.js +0 -355
  218. package/src/lib/pdf/engines.js +0 -46
  219. package/src/lib/pdf/index.test.js +0 -708
  220. package/src/lib/pdf/paged.test.js +0 -366
  221. package/src/lib/pdf/prince.test.js +0 -202
  222. package/src/lib/pdf/schema.js +0 -21
  223. package/src/lib/pdf/split.test.js +0 -445
  224. package/src/lib/platform.js +0 -95
  225. package/src/lib/process/manager.js +0 -110
  226. package/src/lib/process/manager.test.js +0 -55
  227. package/src/lib/project/build.js +0 -162
  228. package/src/lib/project/build.test.js +0 -275
  229. package/src/lib/project/config.js +0 -48
  230. package/src/lib/project/config.test.js +0 -134
  231. package/src/lib/project/detect.js +0 -47
  232. package/src/lib/project/detect.test.js +0 -157
  233. package/src/lib/project/index.js +0 -56
  234. package/src/lib/project/output-paths.js +0 -87
  235. package/src/lib/project/output-paths.test.js +0 -66
  236. package/src/lib/project/paths.js +0 -272
  237. package/src/lib/project/version.js +0 -110
  238. package/src/lib/project/version.test.js +0 -350
  239. package/src/lib/reporter/index.test.js +0 -862
  240. package/src/main.spec.js +0 -61
  241. package/src/main.test.js +0 -347
  242. package/src/validators/validate-data-files.js +0 -154
  243. package/src/validators/validate-data-files.test.js +0 -217
@@ -1,58 +0,0 @@
1
- /**
2
- * Centralized error exports for Quire CLI
3
- *
4
- * All custom error classes are exported from here for easy imports.
5
- *
6
- * @example
7
- * import { NotInProjectError, BuildFailedError } from '#src/errors/index.js'
8
- *
9
- * @module errors
10
- */
11
-
12
- // Base error class
13
- export { default as QuireError } from './quire-error.js'
14
-
15
- // Project errors (exit code: 2)
16
- export {
17
- NotInProjectError,
18
- ProjectCreateError
19
- } from './project/index.js'
20
-
21
- // Build errors (exit code: 3)
22
- export {
23
- BuildFailedError,
24
- ConfigFieldMissingError,
25
- ConfigFileNotFoundError
26
- } from './build/index.js'
27
-
28
- // Output errors (exit code: 5)
29
- export {
30
- EpubGenerationError,
31
- InvalidEpubLibraryError,
32
- InvalidPdfLibraryError,
33
- MissingBuildOutputError,
34
- PdfGenerationError,
35
- ToolNotFoundError
36
- } from './output/index.js'
37
-
38
- // Install errors (exit code: 6)
39
- export {
40
- DependencyInstallError,
41
- DirectoryNotEmptyError,
42
- InvalidPathError,
43
- InvalidStarterError,
44
- VersionNotFoundError
45
- } from './install/index.js'
46
-
47
- // Validation errors (exit code: 4)
48
- export {
49
- ValidationError,
50
- UnknownConfigKeyError,
51
- UnknownConfigOperationError
52
- } from './validation/index.js'
53
-
54
- // Input errors (exit code: 2)
55
- export { InvalidInputError } from './input/index.js'
56
-
57
- // Help errors (exit code: 2)
58
- export { HelpTopicNotFoundError } from './help/index.js'
@@ -1,8 +0,0 @@
1
- /**
2
- * Input errors (exit code: 2)
3
- *
4
- * Errors related to invalid user input (arguments, options, values).
5
- *
6
- * @module errors/input
7
- */
8
- export { default as InvalidInputError } from './invalid-input-error.js'
@@ -1,21 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
-
3
- /**
4
- * Error thrown when user input is invalid
5
- *
6
- * Generic error for invalid arguments, options, or other user-provided values.
7
- * Can be extended for specific input validation scenarios.
8
- */
9
- export default class InvalidInputError extends QuireError {
10
- constructor(message, options = {}) {
11
- super(message, {
12
- code: options.code || 'INVALID_INPUT',
13
- exitCode: options.exitCode ?? 2,
14
- suggestion: options.suggestion,
15
- docsUrl: options.docsUrl,
16
- ...options
17
- })
18
- this.inputValue = options.inputValue
19
- this.inputName = options.inputName
20
- }
21
- }
@@ -1,19 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when dependency installation fails
6
- */
7
- export default class DependencyInstallError extends QuireError {
8
- constructor(details) {
9
- super(
10
- `Failed to install dependencies: ${details}`,
11
- {
12
- code: 'DEPENDENCY_INSTALL_FAILED',
13
- exitCode: 6,
14
- suggestion: "Try running 'npm install' manually to see detailed errors",
15
- docsUrl: docsUrl('troubleshooting')
16
- }
17
- )
18
- }
19
- }
@@ -1,25 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when attempting to create a project in a non-empty directory
6
- *
7
- * This error indicates the target directory contains existing files,
8
- * which could be user content that should not be overwritten or deleted.
9
- */
10
- export default class DirectoryNotEmptyError extends QuireError {
11
- constructor(path) {
12
- const location = path === '.' ? 'the current directory' : path
13
- super(
14
- `Cannot create project in a non-empty directory: ${location}`,
15
- {
16
- code: 'DIRECTORY_NOT_EMPTY',
17
- exitCode: 2,
18
- filePath: path,
19
- suggestion: 'Choose an empty directory or create a new one',
20
- docsUrl: docsUrl('install-uninstall'),
21
- showDebugHint: false
22
- }
23
- )
24
- }
25
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Installation errors (exit code: 6)
3
- *
4
- * Errors related to dependency installation and version management.
5
- *
6
- * @module errors/install
7
- */
8
- export { default as DependencyInstallError } from './dependency-install-error.js'
9
- export { default as DirectoryNotEmptyError } from './directory-not-empty-error.js'
10
- export { default as InvalidPathError } from './invalid-path-error.js'
11
- export { default as InvalidStarterError } from './invalid-starter-error.js'
12
- export { default as VersionNotFoundError } from './version-not-found-error.js'
@@ -1,31 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when a specified path does not exist
6
- *
7
- * Used when --quire-path option points to a non-existent directory.
8
- */
9
- export default class InvalidPathError extends QuireError {
10
- /**
11
- * @param {string} originalPath - The path as provided by the user
12
- * @param {string} resolvedPath - The fully resolved absolute path
13
- */
14
- constructor(originalPath, resolvedPath) {
15
- const pathDisplay = originalPath === resolvedPath
16
- ? originalPath
17
- : `${originalPath} (resolved to: ${resolvedPath})`
18
-
19
- super(
20
- `--quire-path does not exist: ${pathDisplay}`,
21
- {
22
- code: 'INVALID_PATH',
23
- exitCode: 6,
24
- filePath: resolvedPath,
25
- suggestion: 'Verify the path exists and is accessible',
26
- docsUrl: docsUrl('install-uninstall'),
27
- showDebugHint: false
28
- }
29
- )
30
- }
31
- }
@@ -1,27 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when a starter template is invalid
6
- *
7
- * Used when the starter argument points to a non-existent path
8
- * or a path that is not a valid git repository.
9
- */
10
- export default class InvalidStarterError extends QuireError {
11
- /**
12
- * @param {string} starterPath - The starter path that is invalid
13
- * @param {string} reason - Why the starter is invalid
14
- */
15
- constructor(starterPath, reason) {
16
- super(
17
- `Invalid starter template '${starterPath}': ${reason}`,
18
- {
19
- code: 'INVALID_STARTER',
20
- exitCode: 6,
21
- filePath: starterPath,
22
- suggestion: 'Verify the path exists and is a git repository, or use a repository URL',
23
- docsUrl: docsUrl('install-uninstall')
24
- }
25
- )
26
- }
27
- }
@@ -1,35 +0,0 @@
1
- import path from 'node:path'
2
- import QuireError from '../quire-error.js'
3
- import { docsUrl } from '#helpers/docs-url.js'
4
-
5
- /**
6
- * Error thrown when a package version cannot be determined
7
- *
8
- * Handles both npm registry lookups and local package paths.
9
- */
10
- export default class VersionNotFoundError extends QuireError {
11
- /**
12
- * @param {string} packageName - Package name or path description
13
- * @param {string} reason - Version string for npm, or reason for local path
14
- * @param {Object} [options] - Override default suggestion
15
- * @param {string} [options.suggestion] - Custom suggestion text
16
- */
17
- constructor(packageName, reason, options = {}) {
18
- const isLocalPath = packageName.includes(path.sep)
19
- const defaultSuggestion = isLocalPath
20
- ? 'Ensure the local package has a valid package.json with a version field'
21
- : `Run 'npm view ${packageName} versions' to see available versions`
22
-
23
- super(
24
- isLocalPath
25
- ? `Cannot determine version from ${packageName}: ${reason}`
26
- : `Version '${reason}' of ${packageName} not found`,
27
- {
28
- code: 'VERSION_NOT_FOUND',
29
- exitCode: 6,
30
- suggestion: options.suggestion || defaultSuggestion,
31
- docsUrl: docsUrl('install-uninstall')
32
- }
33
- )
34
- }
35
- }
@@ -1,19 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when EPUB generation fails
6
- */
7
- export default class EpubGenerationError extends QuireError {
8
- constructor(details) {
9
- super(
10
- `EPUB generation failed: ${details}`,
11
- {
12
- code: 'EPUB_FAILED',
13
- exitCode: 5,
14
- suggestion: 'Check that your publication built successfully first',
15
- docsUrl: docsUrl('epub-output')
16
- }
17
- )
18
- }
19
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Output generation errors (exit code: 5)
3
- *
4
- * Errors related to PDF and EPUB generation including
5
- * missing build output and external tool issues.
6
- *
7
- * @module errors/output
8
- */
9
- export { default as EpubGenerationError } from './epub-generation-error.js'
10
- export { default as InvalidEpubLibraryError } from './invalid-epub-library-error.js'
11
- export { default as InvalidPdfLibraryError } from './invalid-pdf-library-error.js'
12
- export { default as MissingBuildOutputError } from './missing-build-output-error.js'
13
- export { default as PdfGenerationError } from './pdf-generation-error.js'
14
- export { default as ToolNotFoundError } from './tool-not-found-error.js'
@@ -1,20 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when an unrecognized EPUB library is specified
6
- */
7
- export default class InvalidEpubLibraryError extends QuireError {
8
- constructor(libName, validLibraries = ['epubjs', 'pandoc']) {
9
- super(
10
- `Unrecognized EPUB library '${libName}'`,
11
- {
12
- code: 'INVALID_EPUB_LIBRARY',
13
- exitCode: 5,
14
- suggestion: `Use one of: ${validLibraries.join(', ')}`,
15
- docsUrl: docsUrl('epub-output'),
16
- showDebugHint: false
17
- }
18
- )
19
- }
20
- }
@@ -1,20 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when an unrecognized PDF library is specified
6
- */
7
- export default class InvalidPdfLibraryError extends QuireError {
8
- constructor(libName, validLibraries = ['prince', 'pagedjs']) {
9
- super(
10
- `Unrecognized PDF library '${libName}'`,
11
- {
12
- code: 'INVALID_PDF_LIBRARY',
13
- exitCode: 5,
14
- suggestion: `Use one of: ${validLibraries.join(', ')}`,
15
- docsUrl: docsUrl('pdf-output'),
16
- showDebugHint: false
17
- }
18
- )
19
- }
20
- }
@@ -1,21 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when required build output is missing
6
- */
7
- export default class MissingBuildOutputError extends QuireError {
8
- constructor(outputType, expectedPath) {
9
- super(
10
- `Cannot generate ${outputType}: build output not found`,
11
- {
12
- code: 'BUILD_OUTPUT_MISSING',
13
- exitCode: 5,
14
- filePath: expectedPath,
15
- suggestion: "Run 'quire build' first, then try again",
16
- docsUrl: docsUrl('quire-commands'),
17
- showDebugHint: false
18
- }
19
- )
20
- }
21
- }
@@ -1,24 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when PDF generation fails
6
- *
7
- * @param {string} tool - The PDF tool that failed (e.g., 'Paged.js', 'Prince')
8
- * @param {string} operation - The operation that failed (e.g., 'PDF rendering', 'page map extraction')
9
- * @param {string} [details] - Additional error details from the underlying error
10
- */
11
- export default class PdfGenerationError extends QuireError {
12
- constructor(tool, operation, details) {
13
- const message = details
14
- ? `${tool} ${operation} failed: ${details}`
15
- : `${tool} ${operation} failed`
16
-
17
- super(message, {
18
- code: 'PDF_FAILED',
19
- exitCode: 5,
20
- suggestion: `Check that ${tool} is properly configured and the input files are valid`,
21
- docsUrl: docsUrl('pdf-output')
22
- })
23
- }
24
- }
@@ -1,37 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when a required external tool is not found
6
- *
7
- * @param {string} toolName - The name of the tool (e.g., 'prince', 'pandoc')
8
- * @param {Object} [toolInfo] - Tool metadata provided by the calling façade
9
- * @param {string} [toolInfo.displayName] - Human-readable tool name
10
- * @param {string} [toolInfo.installUrl] - URL where tool can be downloaded
11
- * @param {string} [toolInfo.docsUrl] - Quire docs URL for this tool's usage
12
- * @param {string} [toolInfo.fallback] - Alternative suggestion (e.g., use default engine)
13
- */
14
- export default class ToolNotFoundError extends QuireError {
15
- constructor(toolName, toolInfo = {}) {
16
- const displayName = toolInfo.displayName || toolName
17
- const installUrl = toolInfo.installUrl || 'the tool documentation'
18
- const toolDocsUrl = toolInfo.docsUrl || docsUrl('troubleshooting')
19
-
20
- let suggestion = `Install ${displayName} from ${installUrl}`
21
- if (toolInfo.fallback) {
22
- suggestion += `\n${toolInfo.fallback}`
23
- }
24
-
25
- super(
26
- `${displayName} is not installed or not in PATH`,
27
- {
28
- code: 'TOOL_NOT_FOUND',
29
- exitCode: 5,
30
- suggestion,
31
- docsUrl: toolDocsUrl,
32
- }
33
- )
34
-
35
- this.toolName = toolName
36
- }
37
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Project-related errors (exit code: 2)
3
- *
4
- * Errors related to project setup and detection.
5
- * Used when commands are run outside a Quire project or project creation fails.
6
- *
7
- * @module errors/project
8
- */
9
- export { default as NotInProjectError } from './not-in-project-error.js'
10
- export { default as ProjectCreateError } from './project-create-error.js'
@@ -1,20 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when a command is run outside a Quire project directory
6
- */
7
- export default class NotInProjectError extends QuireError {
8
- constructor(commandName) {
9
- super(
10
- `The '${commandName}' command must be run inside a Quire project`,
11
- {
12
- code: 'NOT_IN_PROJECT',
13
- exitCode: 2,
14
- suggestion: "Navigate to your project folder with 'cd your-project-name'",
15
- docsUrl: docsUrl('quire-commands'),
16
- showDebugHint: false
17
- }
18
- )
19
- }
20
- }
@@ -1,21 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
-
4
- /**
5
- * Error thrown when project creation fails
6
- */
7
- export default class ProjectCreateError extends QuireError {
8
- constructor(projectPath, cause) {
9
- super(
10
- `Failed to create project at '${projectPath}'`,
11
- {
12
- code: 'PROJECT_CREATE_FAILED',
13
- exitCode: 2,
14
- filePath: projectPath,
15
- suggestion: 'Check that the directory is empty and you have write permissions',
16
- docsUrl: docsUrl('getting-started')
17
- }
18
- )
19
- this.cause = cause
20
- }
21
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Base error class for all Quire CLI errors
3
- *
4
- * Provides structured error data for the error handler to format.
5
- *
6
- * @property {string} code - Error code (e.g., 'CONFIG_FILE_NOT_FOUND')
7
- * @property {number} exitCode - Process exit code (default: 1)
8
- * @property {string} suggestion - Actionable fix for the user
9
- * @property {string} docsUrl - Link to relevant documentation
10
- * @property {string} filePath - Source file that caused the error (optional)
11
- * @property {boolean} showDebugHint - Whether to show --debug hint (default: true)
12
- */
13
- export default class QuireError extends Error {
14
- constructor(message, options = {}) {
15
- super(message)
16
- this.name = this.constructor.name
17
- this.code = options.code
18
- this.exitCode = options.exitCode ?? 1
19
- this.suggestion = options.suggestion
20
- this.docsUrl = options.docsUrl
21
- this.filePath = options.filePath
22
- this.showDebugHint = options.showDebugHint ?? true
23
- if ('captureStackTrace' in Error) {
24
- Error.captureStackTrace(this, this.constructor)
25
- }
26
- }
27
- }
@@ -1,3 +0,0 @@
1
- export { default as ValidationError } from './validation-error.js'
2
- export { default as UnknownConfigKeyError } from './unknown-config-key-error.js'
3
- export { default as UnknownConfigOperationError } from './unknown-config-operation-error.js'
@@ -1,27 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
- import { suggestSimilar, formatSuggestion } from '#helpers/suggest-similar.js'
4
-
5
- /**
6
- * Error thrown when an unrecognized configuration key is used
7
- *
8
- * @param {string} key - The unrecognized key
9
- * @param {string[]} validKeys - Array of valid configuration keys
10
- */
11
- export default class UnknownConfigKeyError extends QuireError {
12
- constructor(key, validKeys) {
13
- const suggestion = formatSuggestion(suggestSimilar(key, validKeys))
14
- || `Valid keys: ${validKeys.join(', ')}`
15
-
16
- super(
17
- `Unknown configuration key: ${key}`,
18
- {
19
- code: 'UNKNOWN_CONFIG_KEY',
20
- exitCode: 4,
21
- suggestion,
22
- docsUrl: docsUrl('quire-commands/'),
23
- showDebugHint: false
24
- }
25
- )
26
- }
27
- }
@@ -1,24 +0,0 @@
1
- import QuireError from '../quire-error.js'
2
- import { docsUrl } from '#helpers/docs-url.js'
3
- import { suggestSimilar, formatSuggestion } from '#helpers/suggest-similar.js'
4
-
5
- /**
6
- * Error thrown when an unrecognized settings operation is used
7
- */
8
- export default class UnknownConfigOperationError extends QuireError {
9
- constructor(operation, validOperations) {
10
- const suggestion = formatSuggestion(suggestSimilar(operation, validOperations))
11
- || `Valid operations: ${validOperations.join(', ')}`
12
-
13
- super(
14
- `Unknown operation: ${operation}`,
15
- {
16
- code: 'UNKNOWN_CONFIG_OPERATION',
17
- exitCode: 4,
18
- suggestion,
19
- docsUrl: docsUrl('quire-commands/'),
20
- showDebugHint: false
21
- }
22
- )
23
- }
24
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Helper module for constructing documentation URLs
3
- * @module helpers/docs-url
4
- */
5
-
6
- /**
7
- * Base URL for Quire documentation
8
- */
9
- const DOCS_BASE = 'https://quire.getty.edu/docs-v1/'
10
-
11
- /**
12
- * Export the base URL for cases where direct access is needed
13
- */
14
- export { DOCS_BASE }
15
-
16
- /**
17
- * Construct a full documentation URL from a path segment
18
- *
19
- * Uses the URL constructor for automatic path normalization.
20
- *
21
- * @param {string} path - Documentation path segment (e.g., 'install-uninstall')
22
- * @returns {string} Full documentation URL
23
- *
24
- * @example
25
- * docsUrl('install-uninstall')
26
- * // => 'https://quire.getty.edu/docs-v1/install-uninstall'
27
- *
28
- * @example
29
- * docsUrl('quire-commands')
30
- * // => 'https://quire.getty.edu/docs-v1/quire-commands'
31
- */
32
- export const docsUrl = (path) => new URL(path, DOCS_BASE).href
@@ -1,59 +0,0 @@
1
- /**
2
- * Terminal pager utility
3
- *
4
- * Provides paged output for long content in interactive terminals.
5
- * Paging can be disabled with:
6
- * - `--no-pager` CLI flag (sets NO_PAGER env var)
7
- * - `NO_PAGER=1` environment variable
8
- * - `PAGER=cat` traditional Unix convention (content passes through without paging)
9
- *
10
- * @module helpers/pager
11
- */
12
- import { spawn } from 'node:child_process'
13
-
14
- /**
15
- * Output content with optional paging for long content
16
- *
17
- * Uses system pager (less/more) when:
18
- * - Output is to an interactive terminal (TTY)
19
- * - Content exceeds terminal height
20
- * - Paging is not disabled via NO_PAGER env var
21
- *
22
- * The PAGER env var selects the pager program (default: less on Unix, more on
23
- * Windows). Setting PAGER=cat effectively disables paging as a traditional
24
- * Unix convention.
25
- *
26
- * @param {string} content - Content to output
27
- * @returns {Promise<void>}
28
- */
29
- export async function outputWithPaging(content) {
30
- const noPager = process.env.NO_PAGER
31
- const lines = content.split('\n').length
32
- const isTTY = process.stdout.isTTY
33
- const terminalRows = process.stdout.rows || 24
34
-
35
- // Use pager if content exceeds terminal height and we're in a TTY
36
- if (!noPager && isTTY && lines > terminalRows) {
37
- const pager = process.env.PAGER || (process.platform === 'win32' ? 'more' : 'less')
38
- const pagerArgs = pager === 'less' ? ['-R'] : [] // -R preserves ANSI colors
39
-
40
- return new Promise((resolve) => {
41
- const child = spawn(pager, pagerArgs, {
42
- stdio: ['pipe', 'inherit', 'inherit']
43
- })
44
-
45
- child.stdin.write(content + '\n')
46
- child.stdin.end()
47
-
48
- child.on('close', resolve)
49
- child.on('error', () => {
50
- // Fallback to direct output if pager fails
51
- process.stdout.write(content + '\n')
52
- resolve()
53
- })
54
- })
55
- }
56
-
57
- // Direct output for non-TTY or short content
58
- process.stdout.write(content + '\n')
59
- }