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.
- package/README.md +422 -0
- package/dist/CGATS21_CRPC1-g0e3k7kr.icc +0 -0
- package/dist/api/index.d.ts +76 -0
- package/dist/api/index.js +272 -0
- package/dist/assets/preview/scripts/pagedjs-bridge.d.ts +1 -0
- package/dist/assets/preview/scripts/pagedjs-interface.d.ts +1 -0
- package/dist/assets/preview/scripts/preview-shell.d.ts +1 -0
- package/dist/audit-1jrwwacz.js +66 -0
- package/dist/build-5s92kgpc.js +77 -0
- package/dist/chapter-01-6fn9pvd0.md +31 -0
- package/dist/chapter-01-7jwqg1ct.md +20 -0
- package/dist/chapter-01-jj8ftn4c.md +29 -0
- package/dist/chapter-01-rkpyvjna.md +26 -0
- package/dist/checks/asset/approved-fonts.d.ts +3 -0
- package/dist/checks/asset/extensions.d.ts +41 -0
- package/dist/checks/asset/font-license.d.ts +3 -0
- package/dist/checks/asset/image-alpha.d.ts +3 -0
- package/dist/checks/asset/image-color-space.d.ts +3 -0
- package/dist/checks/asset/image-file-size.d.ts +3 -0
- package/dist/checks/asset/image-resolution.d.ts +3 -0
- package/dist/checks/asset/image-tac.d.ts +3 -0
- package/dist/checks/asset/index.d.ts +7 -0
- package/dist/checks/formatter.d.ts +3 -0
- package/dist/checks/heuristic/index.d.ts +4 -0
- package/dist/checks/heuristic/layer-count.d.ts +3 -0
- package/dist/checks/heuristic/placement-variance.d.ts +3 -0
- package/dist/checks/heuristic/section-density.d.ts +3 -0
- package/dist/checks/heuristic/text-density.d.ts +3 -0
- package/dist/checks/pdf/bleed.d.ts +3 -0
- package/dist/checks/pdf/bookmarks.d.ts +3 -0
- package/dist/checks/pdf/color-spaces.d.ts +3 -0
- package/dist/checks/pdf/cross-refs.d.ts +3 -0
- package/dist/checks/pdf/embedded-fonts.d.ts +3 -0
- package/dist/checks/pdf/image-resolution.d.ts +3 -0
- package/dist/checks/pdf/index.d.ts +15 -0
- package/dist/checks/pdf/ink-coverage.d.ts +3 -0
- package/dist/checks/pdf/page-labels.d.ts +3 -0
- package/dist/checks/pdf/page-size.d.ts +3 -0
- package/dist/checks/pdf/pdfx-markers.d.ts +3 -0
- package/dist/checks/pdf/pdfx-metadata.d.ts +3 -0
- package/dist/checks/pdf/pdfx-structure.d.ts +6 -0
- package/dist/checks/pdf/qpdf-structure.d.ts +3 -0
- package/dist/checks/pdf/rasterized-pages.d.ts +3 -0
- package/dist/checks/pdf/toc-links.d.ts +3 -0
- package/dist/checks/pdf/transparency.d.ts +3 -0
- package/dist/checks/policy.d.ts +61 -0
- package/dist/checks/register-builtins.d.ts +17 -0
- package/dist/checks/registry.d.ts +40 -0
- package/dist/checks/runner.d.ts +25 -0
- package/dist/checks/source/accessibility-alt-text.d.ts +3 -0
- package/dist/checks/source/accessibility-heading-order.d.ts +3 -0
- package/dist/checks/source/config-file.d.ts +8 -0
- package/dist/checks/source/htmlhint.d.ts +3 -0
- package/dist/checks/source/index.d.ts +6 -0
- package/dist/checks/source/local-refs.d.ts +3 -0
- package/dist/checks/source/markdownlint.d.ts +3 -0
- package/dist/checks/source/stylelint.d.ts +3 -0
- package/dist/checks/tool-check.d.ts +23 -0
- package/dist/checks/types.d.ts +52 -0
- package/dist/cli-1tyj4bk3.js +124 -0
- package/dist/cli-37x76zdn.js +4 -0
- package/dist/cli-506tg37g.js +26 -0
- package/dist/cli-5bxx0c4y.js +464 -0
- package/dist/cli-7ykx7pp0.js +12378 -0
- package/dist/cli-h7phg3ka.js +746 -0
- package/dist/cli-hvqjs342.js +284 -0
- package/dist/cli-yja077f6.js +92 -0
- package/dist/cli.js +157 -0
- package/dist/constants.d.ts +17 -0
- package/dist/doctor-25zjt8dz.js +57 -0
- package/dist/favicon-wkbm9cjn.ico +0 -0
- package/dist/git-http-yrb4ag6z.js +17 -0
- package/dist/index-1tyj4bk3.js +124 -0
- package/dist/index-37x76zdn.js +4 -0
- package/dist/index-3h3fef7r.js +15218 -0
- package/dist/index-5bxx0c4y.js +464 -0
- package/dist/index-yja077f6.js +92 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +310 -0
- package/dist/lib/app-heartbeat.d.ts +102 -0
- package/dist/lib/asset-inline.d.ts +73 -0
- package/dist/lib/browser-pool.d.ts +17 -0
- package/dist/lib/build-error.d.ts +52 -0
- package/dist/lib/build-fingerprint.d.ts +15 -0
- package/dist/lib/build-preflight.d.ts +43 -0
- package/dist/lib/build-runner.d.ts +161 -0
- package/dist/lib/build-staging.d.ts +64 -0
- package/dist/lib/chromium.d.ts +20 -0
- package/dist/lib/cli-args.d.ts +45 -0
- package/dist/lib/desktop.d.ts +14 -0
- package/dist/lib/diagnostics.d.ts +64 -0
- package/dist/lib/embedded-assets.d.ts +29 -0
- package/dist/lib/exec.d.ts +84 -0
- package/dist/lib/fetch-timeout.d.ts +41 -0
- package/dist/lib/ghostscript.d.ts +48 -0
- package/dist/lib/host-policy.d.ts +75 -0
- package/dist/lib/image-inspect.d.ts +32 -0
- package/dist/lib/install-hints.d.ts +21 -0
- package/dist/lib/lint-runner.d.ts +10 -0
- package/dist/lib/manifest-config.d.ts +31 -0
- package/dist/lib/manifest-doc.d.ts +25 -0
- package/dist/lib/manifest.d.ts +41 -0
- package/dist/lib/markdown/assemble.d.ts +78 -0
- package/dist/lib/markdown/chapter-id.d.ts +24 -0
- package/dist/lib/markdown/images.d.ts +34 -0
- package/dist/lib/markdown/index.d.ts +78 -0
- package/dist/lib/markdown/markdown-it-paged.d.ts +30 -0
- package/dist/lib/markdown/plugins.d.ts +69 -0
- package/dist/lib/markdown/renderer.d.ts +111 -0
- package/dist/lib/npm-plugin-installer.d.ts +33 -0
- package/dist/lib/open-path.d.ts +5 -0
- package/dist/lib/output-paths.d.ts +23 -0
- package/dist/lib/pagedjs-marker.d.ts +42 -0
- package/dist/lib/pagedjs.d.ts +26 -0
- package/dist/lib/pagination.d.ts +169 -0
- package/dist/lib/pdf-inspect.d.ts +123 -0
- package/dist/lib/pdf-parse.d.ts +57 -0
- package/dist/lib/plugin-manager.d.ts +108 -0
- package/dist/lib/plugin-vendor.d.ts +107 -0
- package/dist/lib/presets.d.ts +45 -0
- package/dist/lib/printsafe.d.ts +17 -0
- package/dist/lib/project-scaffold.d.ts +116 -0
- package/dist/lib/project-source.d.ts +140 -0
- package/dist/lib/project-templates.d.ts +49 -0
- package/dist/lib/publish/butler.d.ts +10 -0
- package/dist/lib/publish/command-runner.d.ts +18 -0
- package/dist/lib/publish/connect.d.ts +23 -0
- package/dist/lib/publish/manifest-publish.d.ts +9 -0
- package/dist/lib/publish/providers/azure-swa.d.ts +3 -0
- package/dist/lib/publish/providers/drivethrurpg.d.ts +10 -0
- package/dist/lib/publish/providers/guided.d.ts +3 -0
- package/dist/lib/publish/providers/itch.d.ts +5 -0
- package/dist/lib/publish/providers/kdp.d.ts +9 -0
- package/dist/lib/publish/providers/shopify.d.ts +5 -0
- package/dist/lib/publish/registry.d.ts +5 -0
- package/dist/lib/publish/run-publish.d.ts +30 -0
- package/dist/lib/publish/selections.d.ts +25 -0
- package/dist/lib/publish/types.d.ts +258 -0
- package/dist/lib/remote-auth/clone.d.ts +87 -0
- package/dist/lib/remote-auth/conflict-resolution.d.ts +29 -0
- package/dist/lib/remote-auth/diagnose.d.ts +77 -0
- package/dist/lib/remote-auth/generic-auth.d.ts +97 -0
- package/dist/lib/remote-auth/git-http.d.ts +85 -0
- package/dist/lib/remote-auth/github-auth.d.ts +69 -0
- package/dist/lib/remote-auth/github-repos.d.ts +64 -0
- package/dist/lib/remote-auth/operation-log.d.ts +66 -0
- package/dist/lib/remote-auth/recovery/abort-interrupted-operation.d.ts +103 -0
- package/dist/lib/remote-auth/recovery/backup.d.ts +113 -0
- package/dist/lib/remote-auth/recovery/classify.d.ts +109 -0
- package/dist/lib/remote-auth/recovery/context.d.ts +47 -0
- package/dist/lib/remote-auth/recovery/dispatch.d.ts +33 -0
- package/dist/lib/remote-auth/recovery/failsafe.d.ts +33 -0
- package/dist/lib/remote-auth/recovery/inspect.d.ts +74 -0
- package/dist/lib/remote-auth/recovery/manual-guidance.d.ts +28 -0
- package/dist/lib/remote-auth/recovery/outcome-mapping.d.ts +58 -0
- package/dist/lib/remote-auth/recovery/policy.d.ts +47 -0
- package/dist/lib/remote-auth/recovery/recover-auth.d.ts +42 -0
- package/dist/lib/remote-auth/recovery/recover-binary-conflict.d.ts +37 -0
- package/dist/lib/remote-auth/recovery/recover-corrupt-index.d.ts +40 -0
- package/dist/lib/remote-auth/recovery/recover-detached-head.d.ts +70 -0
- package/dist/lib/remote-auth/recovery/recover-interrupted-cherry-pick.d.ts +23 -0
- package/dist/lib/remote-auth/recovery/recover-interrupted-merge.d.ts +28 -0
- package/dist/lib/remote-auth/recovery/recover-interrupted-rebase.d.ts +39 -0
- package/dist/lib/remote-auth/recovery/recover-merge-conflict.d.ts +34 -0
- package/dist/lib/remote-auth/recovery/recover-missing-git-dir.d.ts +37 -0
- package/dist/lib/remote-auth/recovery/recover-missing-objects.d.ts +56 -0
- package/dist/lib/remote-auth/recovery/recover-network.d.ts +34 -0
- package/dist/lib/remote-auth/recovery/recover-non-fast-forward.d.ts +27 -0
- package/dist/lib/remote-auth/recovery/recover-stale-lock.d.ts +76 -0
- package/dist/lib/remote-auth/recovery/recover-unrelated-histories.d.ts +44 -0
- package/dist/lib/remote-auth/recovery/recover-wrong-remote.d.ts +35 -0
- package/dist/lib/remote-auth/recovery/types.d.ts +235 -0
- package/dist/lib/remote-auth/resolution-plan.d.ts +64 -0
- package/dist/lib/remote-auth/sync-messages.d.ts +26 -0
- package/dist/lib/remote-auth/sync-types.d.ts +225 -0
- package/dist/lib/remote-auth/sync.d.ts +45 -0
- package/dist/lib/remote-auth/test-access.d.ts +47 -0
- package/dist/lib/remote-auth/test-support/git-http-server.d.ts +71 -0
- package/dist/lib/remote-auth/token-store.d.ts +95 -0
- package/dist/lib/remote-auth/transport.d.ts +105 -0
- package/dist/lib/slug.d.ts +28 -0
- package/dist/lib/snippets.d.ts +39 -0
- package/dist/lib/source-provider.d.ts +244 -0
- package/dist/lib/static-serve.d.ts +54 -0
- package/dist/lib/style-resolver.d.ts +30 -0
- package/dist/lib/theme-import.d.ts +70 -0
- package/dist/lib/theme-manager.d.ts +128 -0
- package/dist/lib/tool-probe.d.ts +37 -0
- package/dist/lib/validation-exec.d.ts +47 -0
- package/dist/lib/validation-profile.d.ts +18 -0
- package/dist/lib/version.d.ts +9 -0
- package/dist/lint-f63nxjfj.js +65 -0
- package/dist/manifest-n1gh3qw5.yaml +9 -0
- package/dist/manifest-ryyg71nf.yaml +9 -0
- package/dist/manifest.schema-rn1dpdpn.json +564 -0
- package/dist/new-7b08a42h.js +105 -0
- package/dist/paged.polyfill-n95pbxfn.js +33288 -0
- package/dist/pagedjs-bridge-vn4hk9fx.js +111 -0
- package/dist/pagedjs-interface-80g3xa8p.js +498 -0
- package/dist/platform.d.ts +100 -0
- package/dist/plugin-wf2cbmwc.js +129 -0
- package/dist/preflight-tg4mpz1h.js +222 -0
- package/dist/preview/file-watcher.d.ts +174 -0
- package/dist/preview/http-server.d.ts +45 -0
- package/dist/preview/lifecycle.d.ts +67 -0
- package/dist/preview/server-context.d.ts +36 -0
- package/dist/preview-h2bwbb2x.js +102 -0
- package/dist/preview-shell-rghtfmc8.js +155 -0
- package/dist/project-source-0tg0r6vm.js +17 -0
- package/dist/publish-ztaet53r.js +233 -0
- package/dist/render.d.ts +20 -0
- package/dist/render.js +682 -0
- package/dist/repair-jkp4n3j8.js +171 -0
- package/dist/schema/manifest.types.d.ts +218 -0
- package/dist/server.d.ts +34 -0
- package/dist/source-provider-hp96b5jf.js +46 -0
- package/dist/test-helpers/testkit.d.ts +91 -0
- package/dist/theme-0yzvthe8.css +65 -0
- package/dist/theme-570zmh2t.css +58 -0
- package/dist/theme-6a2fngc8.json +6 -0
- package/dist/theme-cd6efzjw.json +6 -0
- package/dist/theme-nya4nqh6.css +70 -0
- package/dist/theme-tqfypc1w.json +6 -0
- package/dist/theme-xt0hjb1b.json +6 -0
- package/dist/theme-zz2ktzqs.css +60 -0
- package/dist/types.d.ts +31 -0
- package/dist/utils/file-utils.d.ts +53 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/validate-k2drs19j.js +99 -0
- package/package.json +102 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./qpdf-structure";
|
|
2
|
+
import "./page-size";
|
|
3
|
+
import "./pdfx-markers";
|
|
4
|
+
import "./color-spaces";
|
|
5
|
+
import "./embedded-fonts";
|
|
6
|
+
import "./ink-coverage";
|
|
7
|
+
import "./rasterized-pages";
|
|
8
|
+
import "./bookmarks";
|
|
9
|
+
import "./toc-links";
|
|
10
|
+
import "./cross-refs";
|
|
11
|
+
import "./page-labels";
|
|
12
|
+
import "./image-resolution";
|
|
13
|
+
import "./transparency";
|
|
14
|
+
import "./bleed";
|
|
15
|
+
import "./pdfx-metadata";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type PdfxFlavor = "x1a" | "x3";
|
|
2
|
+
type JsonObject = Record<string, unknown>;
|
|
3
|
+
export declare function parseQpdfObjectsJson(stdout: string): JsonObject | null;
|
|
4
|
+
export declare function getPdfxOutputIntentIssues(objects: JsonObject): string[];
|
|
5
|
+
export declare function getPdfxMetadataIssues(objects: JsonObject, flavor: PdfxFlavor): string[];
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Check, CheckCategory, CheckPhase, CheckResult } from "./types";
|
|
2
|
+
import type { ResolvedConfig } from "../schema/manifest.types";
|
|
3
|
+
/**
|
|
4
|
+
* Machine-readable `code` marking a result produced by an inspection / tool
|
|
5
|
+
* FAILURE (we could not parse or probe the artifact) — as opposed to a genuine
|
|
6
|
+
* content violation. The report layer can branch on this without parsing prose.
|
|
7
|
+
*/
|
|
8
|
+
export declare const INSPECT_FAILED_CODE = "inspect-failed";
|
|
9
|
+
/**
|
|
10
|
+
* The single source of truth for whether a check runs under a given config.
|
|
11
|
+
* Used by BOTH the runner (execution) and tool-check (tool probing) so the two
|
|
12
|
+
* can never drift.
|
|
13
|
+
*
|
|
14
|
+
* Order: an explicit manifest disable wins first, then the check's own
|
|
15
|
+
* declarative `enabledWhen(config)` predicate — the canonical, per-check way to
|
|
16
|
+
* express a tool-specific config gate (e.g. `source.stylelint === false`)
|
|
17
|
+
* instead of hard-coding special cases in the runner/tool-check.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isCheckEnabled(check: Check, config: ResolvedConfig): boolean;
|
|
20
|
+
/** Selector inputs shared by check execution and tool probing. */
|
|
21
|
+
export interface CheckSelectionOptions {
|
|
22
|
+
only?: string[];
|
|
23
|
+
skip?: string[];
|
|
24
|
+
category?: CheckCategory | CheckCategory[];
|
|
25
|
+
phase?: CheckPhase;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckSelection {
|
|
28
|
+
checks: Check[];
|
|
29
|
+
/** Selectors (from `only`/`skip`) that matched no registered check. */
|
|
30
|
+
unmatched: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The check-selection sequence shared by {@link runChecks} and
|
|
34
|
+
* {@link checkToolAvailability} (audit E10): resolve `only`/`skip` selectors,
|
|
35
|
+
* then drop manifest-disabled checks via {@link isCheckEnabled}. Extracted so
|
|
36
|
+
* the two callers can never disagree on WHICH checks are in scope — previously
|
|
37
|
+
* this exact three-step sequence was hand-copied in both, kept in sync only by
|
|
38
|
+
* a comment. Returns `unmatched` selectors so each caller decides whether to
|
|
39
|
+
* surface them (the runner errors on them; tool probing deliberately ignores
|
|
40
|
+
* them to avoid double-warning).
|
|
41
|
+
*/
|
|
42
|
+
export declare function selectChecks(opts: CheckSelectionOptions, config: ResolvedConfig): CheckSelection;
|
|
43
|
+
/**
|
|
44
|
+
* Build a genuine finding, injecting the check id. Severity/message/etc. are the
|
|
45
|
+
* caller's configured values — this represents a real content violation, so its
|
|
46
|
+
* severity is honoured (and can be overridden by the manifest).
|
|
47
|
+
*/
|
|
48
|
+
export declare function finding(checkId: string, init: Omit<CheckResult, "checkId">): CheckResult;
|
|
49
|
+
/**
|
|
50
|
+
* Build the result for an inspection / tool FAILURE — a missing tool, an
|
|
51
|
+
* unreadable file, or malformed inspector output. Policy: always a single
|
|
52
|
+
* `warning` tagged `code: "inspect-failed"`, never a hard `error` and never
|
|
53
|
+
* silently dropped, so a transient failure is neither invisible nor
|
|
54
|
+
* build-breaking. Use `finding()` for genuine violations instead.
|
|
55
|
+
*/
|
|
56
|
+
export declare function inspectionFailed(checkId: string, message: string, extra?: {
|
|
57
|
+
file?: string;
|
|
58
|
+
line?: number;
|
|
59
|
+
detail?: string;
|
|
60
|
+
data?: Record<string, unknown>;
|
|
61
|
+
}): CheckResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central registration of the built-in checks (audit B5).
|
|
3
|
+
*
|
|
4
|
+
* The check registry (registry.ts) is a module-level Map populated purely as a
|
|
5
|
+
* side effect of importing each category's index module. Those four imports
|
|
6
|
+
* previously lived only in `lib/validation-exec.ts`, so `runChecks`/`getChecks`
|
|
7
|
+
* reached any other way (a direct import of `checks/runner`, a reordering of the
|
|
8
|
+
* package entry's re-exports) would see an EMPTY registry and silently validate
|
|
9
|
+
* nothing. Importing THIS module makes the registry self-populating regardless
|
|
10
|
+
* of who the first caller is; `runner.ts` imports it at load, so anything that
|
|
11
|
+
* can reach `runChecks` has already registered the built-ins. ESM evaluates a
|
|
12
|
+
* module once, so importing this from several places registers exactly once.
|
|
13
|
+
*/
|
|
14
|
+
import "./pdf/index";
|
|
15
|
+
import "./source/index";
|
|
16
|
+
import "./asset/index";
|
|
17
|
+
import "./heuristic/index";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Check, CheckCategory, CheckPhase } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Register a check in the process-global registry.
|
|
4
|
+
*
|
|
5
|
+
* Returns an unregister function so temporary registrations (tests, mainly)
|
|
6
|
+
* can remove themselves — the registry is a module-level Map shared by every
|
|
7
|
+
* caller in the process, so a leaked throwaway check would silently run in
|
|
8
|
+
* every later unfiltered `runChecks`. The returned function is idempotent and
|
|
9
|
+
* only removes the exact check it registered (a later re-registration under
|
|
10
|
+
* the same id is left untouched). Built-in check modules ignore the return
|
|
11
|
+
* value; they register once at import and live for the process.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerCheck(check: Check): () => void;
|
|
14
|
+
export interface CheckFilter {
|
|
15
|
+
category?: CheckCategory | CheckCategory[];
|
|
16
|
+
phase?: CheckPhase;
|
|
17
|
+
ids?: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function getChecks(filter?: CheckFilter): Check[];
|
|
20
|
+
export declare function getCheckById(id: string): Check | undefined;
|
|
21
|
+
export declare function getAllCheckIds(): string[];
|
|
22
|
+
/**
|
|
23
|
+
* The set of `CheckCategory` values actually in use by registered checks.
|
|
24
|
+
* Derived from the registry (rather than a hand-maintained literal list) so
|
|
25
|
+
* it can never drift from `CheckCategory`'s real members — used to validate
|
|
26
|
+
* `--category` input against something other than a bare `as CheckCategory`
|
|
27
|
+
* cast, which previously accepted any string.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getKnownCategories(): CheckCategory[];
|
|
30
|
+
export interface ResolvedSelectors {
|
|
31
|
+
/** Check IDs matched by the selectors (deduplicated, in match order). */
|
|
32
|
+
resolved: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Selectors that matched no registered check — almost always a typo. Callers
|
|
35
|
+
* MUST surface these; a mistyped `--only`/`--skip` selector silently dropped
|
|
36
|
+
* would otherwise resolve to nothing and report a false "PASSED".
|
|
37
|
+
*/
|
|
38
|
+
unmatched: string[];
|
|
39
|
+
}
|
|
40
|
+
export declare function resolveCheckSelectors(selectors: string[]): ResolvedSelectors;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CheckCategory, CheckContext, CheckPhase, CheckResult } from "./types";
|
|
2
|
+
import "./register-builtins";
|
|
3
|
+
export interface RunnerOptions {
|
|
4
|
+
category?: CheckCategory[];
|
|
5
|
+
phase?: CheckPhase;
|
|
6
|
+
only?: string[];
|
|
7
|
+
skip?: string[];
|
|
8
|
+
/** Check IDs to skip due to missing tools (set by tool-check) */
|
|
9
|
+
skipMissingTools?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface RunnerReport {
|
|
12
|
+
results: CheckResult[];
|
|
13
|
+
errors: CheckResult[];
|
|
14
|
+
warnings: CheckResult[];
|
|
15
|
+
infos: CheckResult[];
|
|
16
|
+
passed: string[];
|
|
17
|
+
summary: {
|
|
18
|
+
total: number;
|
|
19
|
+
errors: number;
|
|
20
|
+
warnings: number;
|
|
21
|
+
infos: number;
|
|
22
|
+
passed: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare function runChecks(ctx: CheckContext, opts?: RunnerOptions): Promise<RunnerReport>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate a lint config file for a source check. An explicit relative path
|
|
3
|
+
* (from the check's manifest config) wins when it exists; otherwise the first
|
|
4
|
+
* of `names` found in the input dir is used. Returns null when nothing
|
|
5
|
+
* matches. Shared by the markdownlint and htmlhint wrappers so their
|
|
6
|
+
* config-discovery rules can never drift.
|
|
7
|
+
*/
|
|
8
|
+
export declare function findConfigFile(inputDir: string, names: readonly string[], explicit?: string | null): string | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./register-builtins";
|
|
2
|
+
import type { ResolvedConfig } from "../schema/manifest.types";
|
|
3
|
+
import type { RunnerOptions } from "./runner";
|
|
4
|
+
export interface ToolCheckResult {
|
|
5
|
+
/** Tools that were checked and found present */
|
|
6
|
+
available: string[];
|
|
7
|
+
/** Tools that are missing */
|
|
8
|
+
missing: string[];
|
|
9
|
+
/** Check IDs that will be skipped due to missing tools */
|
|
10
|
+
skippedChecks: string[];
|
|
11
|
+
/** Mapping: missing tool → check IDs that need it */
|
|
12
|
+
toolToChecks: Map<string, string[]>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Checks whether external tools required by active checks are installed.
|
|
16
|
+
* Skips tools whose only dependent checks are explicitly disabled in the manifest.
|
|
17
|
+
* Returns which tools are missing and which checks will be skipped.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkToolAvailability(config: ResolvedConfig, opts?: RunnerOptions): Promise<ToolCheckResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Log warnings for missing tools, showing which checks will be skipped.
|
|
22
|
+
*/
|
|
23
|
+
export declare function reportMissingTools(result: ToolCheckResult): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "../schema/manifest.types";
|
|
2
|
+
export type CheckSeverity = "error" | "warning" | "info";
|
|
3
|
+
export type CheckCategory = "source" | "pdf" | "asset" | "heuristic";
|
|
4
|
+
export type CheckPhase = "pre-build" | "post-build";
|
|
5
|
+
export interface CheckResult {
|
|
6
|
+
checkId: string;
|
|
7
|
+
severity: CheckSeverity;
|
|
8
|
+
message: string;
|
|
9
|
+
file?: string;
|
|
10
|
+
line?: number;
|
|
11
|
+
column?: number;
|
|
12
|
+
detail?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Stable machine-readable identifier for the KIND of finding (e.g.
|
|
15
|
+
* "ink-coverage-exceeded", "rasterized-pages-detected"). Lets the report /
|
|
16
|
+
* summary layer branch on the finding without parsing `message` prose.
|
|
17
|
+
*/
|
|
18
|
+
code?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Structured payload for the finding (e.g. `{ maxTac, pages }`). The canonical
|
|
21
|
+
* source for summary numbers — `message`/`detail` are for humans only.
|
|
22
|
+
*/
|
|
23
|
+
data?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface CheckContext {
|
|
26
|
+
config: ResolvedConfig;
|
|
27
|
+
inputDir: string;
|
|
28
|
+
outputDir: string;
|
|
29
|
+
pdfPath?: string;
|
|
30
|
+
htmlPath?: string;
|
|
31
|
+
markdownFiles?: string[];
|
|
32
|
+
cssFiles?: string[];
|
|
33
|
+
assetDirs?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface Check {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
category: CheckCategory;
|
|
40
|
+
phase: CheckPhase;
|
|
41
|
+
/** External CLI tools this check requires (e.g. ["qpdf", "pdfinfo"]) */
|
|
42
|
+
requiredTools?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Declarative enable gate driven by config (beyond the generic
|
|
45
|
+
* `validate.checks[id]` enable/disable). Lets a check own a tool-specific
|
|
46
|
+
* config switch — e.g. `source.stylelint === false` — so the runner and
|
|
47
|
+
* tool-check never need per-check special cases. Returning `false` disables
|
|
48
|
+
* the check for enablement/tool-probing purposes.
|
|
49
|
+
*/
|
|
50
|
+
enabledWhen?: (config: ResolvedConfig) => boolean;
|
|
51
|
+
run(ctx: CheckContext): Promise<CheckResult[]>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// src/lib/project-source.ts
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import { stat } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import git from "isomorphic-git";
|
|
7
|
+
function pickSyncRemote(remotes) {
|
|
8
|
+
return remotes.find((r) => r.remote === "origin") ?? remotes[0];
|
|
9
|
+
}
|
|
10
|
+
async function syncRemoteFor(dir) {
|
|
11
|
+
try {
|
|
12
|
+
const remotes = await git.listRemotes({ fs, dir });
|
|
13
|
+
const picked = pickSyncRemote(remotes);
|
|
14
|
+
if (picked?.url)
|
|
15
|
+
return picked;
|
|
16
|
+
} catch {}
|
|
17
|
+
try {
|
|
18
|
+
const url = await git.getConfig({ fs, dir, path: "remote.origin.url" });
|
|
19
|
+
if (url)
|
|
20
|
+
return { remote: "origin", url };
|
|
21
|
+
} catch {}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
async function gitEntryKind(dir) {
|
|
25
|
+
try {
|
|
26
|
+
const s = await stat(path.join(dir, ".git"));
|
|
27
|
+
return s.isDirectory() ? "dir" : "file";
|
|
28
|
+
} catch {
|
|
29
|
+
return "none";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function findEnclosingRepoDir(folderPath) {
|
|
33
|
+
const home = path.resolve(os.homedir());
|
|
34
|
+
let dir = path.resolve(folderPath);
|
|
35
|
+
for (let i = 0;i < 64; i++) {
|
|
36
|
+
const parent = path.dirname(dir);
|
|
37
|
+
if (parent === dir)
|
|
38
|
+
return;
|
|
39
|
+
dir = parent;
|
|
40
|
+
if (dir === home)
|
|
41
|
+
return;
|
|
42
|
+
if (await gitEntryKind(dir) !== "none")
|
|
43
|
+
return dir;
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
async function readRepoInfo(dir) {
|
|
48
|
+
const remoteUrl = (await syncRemoteFor(dir))?.url;
|
|
49
|
+
let branch;
|
|
50
|
+
try {
|
|
51
|
+
branch = await git.currentBranch({ fs, dir }) || undefined;
|
|
52
|
+
} catch {
|
|
53
|
+
branch = undefined;
|
|
54
|
+
}
|
|
55
|
+
return { remoteUrl, branch };
|
|
56
|
+
}
|
|
57
|
+
function repoSubPath(repoRoot, folderPath) {
|
|
58
|
+
const rel = path.relative(path.resolve(repoRoot), path.resolve(folderPath));
|
|
59
|
+
return rel.split(path.sep).join("/");
|
|
60
|
+
}
|
|
61
|
+
async function detectProjectSource(folderPath) {
|
|
62
|
+
if (await gitEntryKind(folderPath) !== "none") {
|
|
63
|
+
const { remoteUrl, branch } = await readRepoInfo(folderPath);
|
|
64
|
+
return {
|
|
65
|
+
type: "local-git-folder",
|
|
66
|
+
path: folderPath,
|
|
67
|
+
repoRoot: folderPath,
|
|
68
|
+
subPath: "",
|
|
69
|
+
hasRemote: remoteUrl !== undefined,
|
|
70
|
+
...remoteUrl !== undefined ? { remoteUrl } : {},
|
|
71
|
+
...branch !== undefined ? { branch } : {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const enclosingRepoDir = await findEnclosingRepoDir(folderPath);
|
|
75
|
+
if (enclosingRepoDir !== undefined) {
|
|
76
|
+
const { remoteUrl, branch } = await readRepoInfo(enclosingRepoDir);
|
|
77
|
+
return {
|
|
78
|
+
type: "local-git-folder",
|
|
79
|
+
path: folderPath,
|
|
80
|
+
repoRoot: enclosingRepoDir,
|
|
81
|
+
subPath: repoSubPath(enclosingRepoDir, folderPath),
|
|
82
|
+
hasRemote: remoteUrl !== undefined,
|
|
83
|
+
...remoteUrl !== undefined ? { remoteUrl } : {},
|
|
84
|
+
...branch !== undefined ? { branch } : {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { type: "local-folder", path: folderPath };
|
|
88
|
+
}
|
|
89
|
+
function capabilitiesFor(source) {
|
|
90
|
+
switch (source.type) {
|
|
91
|
+
case "local-folder":
|
|
92
|
+
return {
|
|
93
|
+
canRead: true,
|
|
94
|
+
canWriteLocal: true,
|
|
95
|
+
canEnableVersionHistory: true,
|
|
96
|
+
canSnapshot: false,
|
|
97
|
+
canViewHistory: false,
|
|
98
|
+
canRestoreSnapshot: false,
|
|
99
|
+
authManagedByApp: false
|
|
100
|
+
};
|
|
101
|
+
case "local-git-folder":
|
|
102
|
+
return {
|
|
103
|
+
canRead: true,
|
|
104
|
+
canWriteLocal: true,
|
|
105
|
+
canEnableVersionHistory: false,
|
|
106
|
+
canSnapshot: true,
|
|
107
|
+
canViewHistory: true,
|
|
108
|
+
canRestoreSnapshot: true,
|
|
109
|
+
authManagedByApp: false
|
|
110
|
+
};
|
|
111
|
+
case "managed-github":
|
|
112
|
+
return {
|
|
113
|
+
canRead: true,
|
|
114
|
+
canWriteLocal: true,
|
|
115
|
+
canEnableVersionHistory: false,
|
|
116
|
+
canSnapshot: true,
|
|
117
|
+
canViewHistory: true,
|
|
118
|
+
canRestoreSnapshot: true,
|
|
119
|
+
authManagedByApp: true
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { pickSyncRemote, syncRemoteFor, findEnclosingRepoDir, repoSubPath, detectProjectSource, capabilitiesFor };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/commands/preview-args.ts
|
|
2
|
+
var previewArgs = {
|
|
3
|
+
input: { type: "positional", description: "Input markdown directory (defaults to current directory)", required: false },
|
|
4
|
+
format: { type: "string", description: "Output format: html (default, live HMR) | pdf | pdfx" },
|
|
5
|
+
port: { type: "string", description: "Port number (default: 3579, html only)" },
|
|
6
|
+
host: { type: "string", description: "Bind host (default: 127.0.0.1). Pass 0.0.0.0 to expose on the LAN." },
|
|
7
|
+
watch: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
default: true,
|
|
10
|
+
description: "Watch files for changes (html only)",
|
|
11
|
+
negativeDescription: "Disable file watching (html only)"
|
|
12
|
+
},
|
|
13
|
+
open: { type: "boolean", default: true, description: "Automatically open browser/desktop (default: true; use --no-open to skip)" },
|
|
14
|
+
verbose: { type: "boolean", description: "Enable verbose output" },
|
|
15
|
+
debug: { type: "boolean", description: "Debug mode (preserve temporary files)" },
|
|
16
|
+
out: { type: "string", description: "Output directory (pdf|pdfx only)" },
|
|
17
|
+
"pdfx-flavor": { type: "string", description: "PDF/X flavor (x1a or x3); only with --format pdfx" },
|
|
18
|
+
icc: { type: "string", description: "Path to ICC profile (required for --format pdfx)" },
|
|
19
|
+
manifest: { type: "string", description: "Path to manifest.yaml (pdf|pdfx only)" },
|
|
20
|
+
"strip-annotations": { type: "boolean", description: "Strip PDF annotations for PDF/X compliance (pdfx only)" },
|
|
21
|
+
"skip-lint": { type: "boolean", description: "Skip CSS linting (pdf|pdfx only)" },
|
|
22
|
+
"skip-pre-validate": { type: "boolean", description: "Skip pre-build validation (pdf|pdfx only)" },
|
|
23
|
+
"skip-post-validate": { type: "boolean", description: "Skip post-build PDF/X validation (pdfx only)" }
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { previewArgs };
|