saturndocs 0.2.0 → 0.3.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/dist/auth-OIEL34E4.js +16 -0
- package/dist/{chunk-GGGL4O7Z.js → chunk-32ATWMIS.js} +3 -3
- package/dist/{chunk-QF2ADHQZ.js → chunk-3EW6ZPL6.js} +5 -5
- package/dist/{chunk-ADZOBRZE.js → chunk-3KCCCMQY.js} +325 -35
- package/dist/{chunk-2RZEC3VH.js → chunk-3X2NBWZN.js} +123 -35
- package/dist/{chunk-EB7RWFQA.js → chunk-5ZYUBLEH.js} +1463 -130
- package/dist/{chunk-WBI4EI3D.js → chunk-6EKGBIUR.js} +2 -2
- package/dist/{chunk-W3GKH5DY.js → chunk-BOWRQKXR.js} +12 -6
- package/dist/{chunk-FGKHDJOC.js → chunk-E3G56DR2.js} +287 -35
- package/dist/chunk-FUZE54DG.js +905 -0
- package/dist/chunk-HBSJ4Z4S.js +53 -0
- package/dist/{chunk-DBMFJXKP.js → chunk-IJOYWJVM.js} +5 -5
- package/dist/chunk-IWIVHHZI.js +426 -0
- package/dist/{chunk-Z5CBPJ2L.js → chunk-PU37LVIF.js} +3 -3
- package/dist/{chunk-4ORVQCHY.js → chunk-RKM7YWPD.js} +25 -6
- package/dist/{chunk-2YTD2XNI.js → chunk-T3MCJYSF.js} +1 -1
- package/dist/{chunk-YSFP37B7.js → chunk-TEYHAN2L.js} +20 -6
- package/dist/{chunk-WUPP3THV.js → chunk-VDGVERLX.js} +5 -5
- package/dist/{chunk-SVDVBZPA.js → chunk-W3FZTCKV.js} +6 -4
- package/dist/chunk-WMS6FUKK.js +414 -0
- package/dist/chunk-WXLJZ7RD.js +115 -0
- package/dist/{chunk-56U46JVN.js → chunk-YGVC4N4V.js} +2 -1
- package/dist/{chunk-6JGAA5TF.js → chunk-YPWPLIEZ.js} +4 -4
- package/dist/cli.js +6 -6
- package/dist/{coverage-EBWULNQQ.js → coverage-SRIA65FT.js} +5 -5
- package/dist/{dist-XISZDQTR.js → dist-LJSALT4X.js} +33 -3
- package/dist/index.d.ts +69 -37
- package/dist/index.js +112 -47
- package/dist/{init-PI4VTG7V.js → init-Y3GDNDWW.js} +5 -3
- package/dist/{lint-SXBP37G3.js → lint-XM26WIGE.js} +3 -3
- package/dist/login-HIXLPRUI.js +22 -0
- package/dist/{manage-OB6DQK3Q.js → manage-3HEBB3EQ.js} +6 -2
- package/dist/{nav-R4OORY2G.js → nav-K43WZJ4J.js} +4 -4
- package/dist/openapiCheck-CL2AH3YC.js +105 -0
- package/dist/pages-4VWB7Z4S.js +16 -0
- package/dist/{read-VECMKHBW.js → read-DYGYUOFK.js} +5 -4
- package/dist/{read-WWOMA67R.js → read-RKT6HUZ7.js} +41 -7
- package/dist/requests-CZYE6GI3.js +13 -0
- package/dist/{schema-NKOXZHQH.js → schema-QMJMGD5P.js} +3 -3
- package/dist/{sites-XMMGWPY2.js → sites-JKS25SEM.js} +5 -4
- package/dist/{status-SYIUUSSU.js → status-FM2ALQUJ.js} +4 -4
- package/dist/{suggestions-GX5CQK26.js → suggestions-Z6XIHMFN.js} +13 -7
- package/dist/unavailable-DVPNUO3J.js +40 -0
- package/dist/validate-X42T4TJ6.js +12 -0
- package/package.json +15 -9
- package/dist/auth-DUYYFNEZ.js +0 -14
- package/dist/brokenLinks-E364XYH3.js +0 -48
- package/dist/build-F5PWGP57.js +0 -39
- package/dist/chunk-4J33CCAC.js +0 -49
- package/dist/chunk-D3CLXV7D.js +0 -131
- package/dist/chunk-GLI3OUYL.js +0 -637
- package/dist/chunk-K5YY6NSF.js +0 -71
- package/dist/chunk-KOJJUISB.js +0 -39
- package/dist/chunk-O72DR5FK.js +0 -152
- package/dist/chunk-VNYDYHXM.js +0 -22
- package/dist/chunk-VXEUNRVA.js +0 -26
- package/dist/chunk-WHNL6UYJ.js +0 -57
- package/dist/deploy-QUVLOGII.js +0 -13
- package/dist/dev-VDSDCBO2.js +0 -43
- package/dist/openapiCheck-X2QQGETY.js +0 -66
- package/dist/pages-MKFZAVGI.js +0 -15
- package/dist/requests-A7WC3B4M.js +0 -13
- package/dist/validate-D4I3DY2W.js +0 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asCliError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FUZE54DG.js";
|
|
4
4
|
import {
|
|
5
5
|
applyCommandHelp
|
|
6
6
|
} from "./chunk-M2BZEDAS.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
commandMetadata,
|
|
9
9
|
createResultWriter,
|
|
10
10
|
failureResult,
|
|
11
|
-
invalidInput,
|
|
11
|
+
invalidInput2 as invalidInput,
|
|
12
12
|
messageOf,
|
|
13
13
|
resolveGlobalOptions,
|
|
14
14
|
successResult
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3KCCCMQY.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/nav.ts
|
|
18
18
|
import { existsSync } from "fs";
|
|
@@ -45,7 +45,7 @@ async function readJson(path, label) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
async function applyOutlineNavigation(docsDir, outlinePath) {
|
|
48
|
-
const { parseOutline, navigationFromOutline } = await import("./dist-
|
|
48
|
+
const { parseOutline, navigationFromOutline } = await import("./dist-LJSALT4X.js");
|
|
49
49
|
const docsPath = resolve(docsDir, "docs.json");
|
|
50
50
|
if (!existsSync(docsPath)) throw invalidInput(`No docs.json found in ${docsDir}. Pass a docs directory.`);
|
|
51
51
|
const config = await readJson(docsPath, "docs.json");
|
package/dist/cli.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
COMMAND_GROUPS,
|
|
4
4
|
selectCommandGroup
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HBSJ4Z4S.js";
|
|
6
6
|
import {
|
|
7
7
|
installInterrupt
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T3MCJYSF.js";
|
|
9
9
|
import {
|
|
10
10
|
EXIT,
|
|
11
11
|
applyGlobalFlags,
|
|
12
12
|
applyGlobalFlagsDeep,
|
|
13
13
|
createResultWriter,
|
|
14
14
|
failureResult,
|
|
15
|
-
invalidInput,
|
|
15
|
+
invalidInput2 as invalidInput,
|
|
16
16
|
wantsJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3KCCCMQY.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -40,7 +40,7 @@ function commandFromArgv(argv) {
|
|
|
40
40
|
}
|
|
41
41
|
function createProgram() {
|
|
42
42
|
const program = new Command();
|
|
43
|
-
program.name("saturndocs").description("SaturnDocs CLI: init, validate,
|
|
43
|
+
program.name("saturndocs").description("SaturnDocs CLI: inspect and operate a site, plus local init, validate, and lint. Publish by pushing to the connected GitHub repository").version(cliVersion()).addHelpCommand(false).showHelpAfterError().configureHelp({ subcommandTerm: (command) => command.name() });
|
|
44
44
|
applyGlobalFlags(program);
|
|
45
45
|
return program;
|
|
46
46
|
}
|
|
@@ -53,7 +53,7 @@ async function registerGroup(program, group) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function addPlaceholder(program, group, writer) {
|
|
56
|
-
program.command(group.name).description(group.summary).allowUnknownOption(true).allowExcessArguments(true).helpOption(false).argument("[args...]").action(async () => {
|
|
56
|
+
program.command(group.name, { hidden: group.hidden === true }).description(group.summary).allowUnknownOption(true).allowExcessArguments(true).helpOption(false).argument("[args...]").action(async () => {
|
|
57
57
|
process.exitCode = await run(process.argv, group, writer);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
COVERAGE_METADATA,
|
|
3
3
|
coverageOfDocsDir,
|
|
4
4
|
registerCoverage
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VDGVERLX.js";
|
|
6
|
+
import "./chunk-YGVC4N4V.js";
|
|
7
|
+
import "./chunk-FUZE54DG.js";
|
|
8
|
+
import "./chunk-T3MCJYSF.js";
|
|
9
9
|
import "./chunk-M2BZEDAS.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-3KCCCMQY.js";
|
|
11
11
|
export {
|
|
12
12
|
COVERAGE_METADATA,
|
|
13
13
|
coverageOfDocsDir,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ADMISSIBLE_FRONTMATTER_KEYS,
|
|
3
|
+
BoundedPool,
|
|
4
|
+
FOREIGN_SYNTAX,
|
|
3
5
|
GIT_COMMIT_PATTERN,
|
|
4
6
|
INCONSISTENT_VALUE_LIST,
|
|
5
7
|
KNOWN_PITFALLS,
|
|
6
8
|
KNOWN_PITFALL_CODE,
|
|
7
9
|
OutlineSchema,
|
|
10
|
+
PAGE_ISSUE_LIMIT,
|
|
8
11
|
PRODUCT_KINDS,
|
|
12
|
+
R2_BYTE_BUDGET,
|
|
13
|
+
R2_CONCURRENCY,
|
|
9
14
|
REJECTED_GENERATED_FILENAMES,
|
|
10
15
|
REJECTED_GENERATED_ROOTS,
|
|
11
16
|
RESERVED_URL_PREFIXES,
|
|
@@ -17,6 +22,7 @@ import {
|
|
|
17
22
|
SOURCE_ABI_VERSION,
|
|
18
23
|
SOURCE_ALLOWED_EXTENSIONS,
|
|
19
24
|
SOURCE_ALLOWED_ROOTS,
|
|
25
|
+
SOURCE_IGNORED_FILES,
|
|
20
26
|
SOURCE_LIMITS,
|
|
21
27
|
SOURCE_MEDIA_TYPES,
|
|
22
28
|
SourceAbiError,
|
|
@@ -31,20 +37,27 @@ import {
|
|
|
31
37
|
changedLineIndexes,
|
|
32
38
|
checkPitfalls,
|
|
33
39
|
contentContract,
|
|
40
|
+
customerComponentRegistry,
|
|
34
41
|
detectSourceMediaType,
|
|
35
42
|
extractClaimTokens,
|
|
36
43
|
extractLinks,
|
|
37
44
|
findUnresolvedLinks,
|
|
45
|
+
frontmatterPolicy,
|
|
38
46
|
groundTokens,
|
|
39
47
|
headingsOf,
|
|
48
|
+
isIgnoredSourceFile,
|
|
49
|
+
isReservedRoute,
|
|
40
50
|
lintContent,
|
|
51
|
+
mapBounded,
|
|
41
52
|
navigationFromOutline,
|
|
42
53
|
normalizeHeading,
|
|
43
54
|
outlineCoverage,
|
|
44
55
|
outlineDocId,
|
|
45
56
|
outlineJsonSchema,
|
|
57
|
+
pageAssetReferences,
|
|
46
58
|
pageSourceComponents,
|
|
47
59
|
parseOutline,
|
|
60
|
+
parsePageBody,
|
|
48
61
|
paxRecord,
|
|
49
62
|
resolveHref,
|
|
50
63
|
revisionId,
|
|
@@ -54,19 +67,26 @@ import {
|
|
|
54
67
|
validateBundleSemantics,
|
|
55
68
|
validateBundleSemanticsAsync,
|
|
56
69
|
validateBundleStructure,
|
|
70
|
+
validatePageBytes,
|
|
57
71
|
validatePageSource,
|
|
72
|
+
validatePageSourceAll,
|
|
58
73
|
violationGuidance
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import "./chunk-
|
|
61
|
-
import "./chunk-
|
|
74
|
+
} from "./chunk-5ZYUBLEH.js";
|
|
75
|
+
import "./chunk-W3FZTCKV.js";
|
|
76
|
+
import "./chunk-E3G56DR2.js";
|
|
62
77
|
export {
|
|
63
78
|
ADMISSIBLE_FRONTMATTER_KEYS,
|
|
79
|
+
BoundedPool,
|
|
80
|
+
FOREIGN_SYNTAX,
|
|
64
81
|
GIT_COMMIT_PATTERN,
|
|
65
82
|
INCONSISTENT_VALUE_LIST,
|
|
66
83
|
KNOWN_PITFALLS,
|
|
67
84
|
KNOWN_PITFALL_CODE,
|
|
68
85
|
OutlineSchema,
|
|
86
|
+
PAGE_ISSUE_LIMIT,
|
|
69
87
|
PRODUCT_KINDS,
|
|
88
|
+
R2_BYTE_BUDGET,
|
|
89
|
+
R2_CONCURRENCY,
|
|
70
90
|
REJECTED_GENERATED_FILENAMES,
|
|
71
91
|
REJECTED_GENERATED_ROOTS,
|
|
72
92
|
RESERVED_URL_PREFIXES,
|
|
@@ -78,6 +98,7 @@ export {
|
|
|
78
98
|
SOURCE_ABI_VERSION,
|
|
79
99
|
SOURCE_ALLOWED_EXTENSIONS,
|
|
80
100
|
SOURCE_ALLOWED_ROOTS,
|
|
101
|
+
SOURCE_IGNORED_FILES,
|
|
81
102
|
SOURCE_LIMITS,
|
|
82
103
|
SOURCE_MEDIA_TYPES,
|
|
83
104
|
SourceAbiError,
|
|
@@ -92,20 +113,27 @@ export {
|
|
|
92
113
|
changedLineIndexes,
|
|
93
114
|
checkPitfalls,
|
|
94
115
|
contentContract,
|
|
116
|
+
customerComponentRegistry,
|
|
95
117
|
detectSourceMediaType,
|
|
96
118
|
extractClaimTokens,
|
|
97
119
|
extractLinks,
|
|
98
120
|
findUnresolvedLinks,
|
|
121
|
+
frontmatterPolicy,
|
|
99
122
|
groundTokens,
|
|
100
123
|
headingsOf,
|
|
124
|
+
isIgnoredSourceFile,
|
|
125
|
+
isReservedRoute,
|
|
101
126
|
lintContent,
|
|
127
|
+
mapBounded,
|
|
102
128
|
navigationFromOutline,
|
|
103
129
|
normalizeHeading,
|
|
104
130
|
outlineCoverage,
|
|
105
131
|
outlineDocId,
|
|
106
132
|
outlineJsonSchema,
|
|
133
|
+
pageAssetReferences,
|
|
107
134
|
pageSourceComponents,
|
|
108
135
|
parseOutline,
|
|
136
|
+
parsePageBody,
|
|
109
137
|
paxRecord,
|
|
110
138
|
resolveHref,
|
|
111
139
|
revisionId,
|
|
@@ -115,6 +143,8 @@ export {
|
|
|
115
143
|
validateBundleSemantics,
|
|
116
144
|
validateBundleSemanticsAsync,
|
|
117
145
|
validateBundleStructure,
|
|
146
|
+
validatePageBytes,
|
|
118
147
|
validatePageSource,
|
|
148
|
+
validatePageSourceAll,
|
|
119
149
|
violationGuidance
|
|
120
150
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { CommandMetadata, ClientErrorCode, ServerFault, MutationOutcome, ExitCode, ClientLimitation, ClientRecovery, DurableIds, ClientError, ClientFailure, ClientSuccess, ClientResult, TextInput, ManagementClient, SiteDiscovery, PagesResult, SiteStatus } from '@saturndocs/management-client';
|
|
3
|
-
import { CoverageReport
|
|
3
|
+
import { CoverageReport } from '@saturndocs/source-abi';
|
|
4
4
|
import { DocsConfig } from '@saturndocs/config';
|
|
5
5
|
import { BrandExtraction, extractBrandFromUrl } from '@saturndocs/brand';
|
|
6
6
|
export { BrandAssetExtraction, BrandExtraction, BrandFetchOptions, BrandFetcher, ColorCandidate, DEFAULT_PRIMARY_COLOR, FetchImplementation, LogoCandidate, LogoSelection, ScoredColor, UrlValidator, colorToHex, deriveDocsJson, extensionForContentType, extractBrandFromUrl, extractBrandText, extractCssColorCandidates, extractManifestUrl, extractStylesheetUrls, extractThemeColorMetas, fetchBrandAsset, normalizeHexColor, normalizeHttpUrl, parseCssColor, pickPrimaryColor, scoreColorCandidates, selectLogoAssets } from '@saturndocs/brand';
|
|
@@ -17,6 +17,11 @@ interface CommandGroup {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly renderer: boolean;
|
|
19
19
|
readonly load: () => Promise<RegisterGroup>;
|
|
20
|
+
/**
|
|
21
|
+
* Registered so an existing script gets a clear refusal instead of an unknown
|
|
22
|
+
* command, but left out of help so nothing advertises it.
|
|
23
|
+
*/
|
|
24
|
+
readonly hidden?: boolean;
|
|
20
25
|
/**
|
|
21
26
|
* The group's command metadata, for `saturndocs schema` and for help. Lazy for
|
|
22
27
|
* the same reason as `load`. A management group without it is a drift-test
|
|
@@ -197,13 +202,35 @@ declare function registerSchema(program: Command): void;
|
|
|
197
202
|
|
|
198
203
|
declare const MANAGE_METADATA: readonly CommandMetadata[];
|
|
199
204
|
|
|
200
|
-
|
|
205
|
+
interface RunResult {
|
|
206
|
+
code: number | null;
|
|
207
|
+
stdout: string;
|
|
208
|
+
stderr: string;
|
|
209
|
+
timedOut: boolean;
|
|
210
|
+
missing: boolean;
|
|
211
|
+
}
|
|
212
|
+
type Runner = (file: string, args: readonly string[], input?: string) => Promise<RunResult>;
|
|
213
|
+
|
|
214
|
+
interface LoginEnvironment {
|
|
215
|
+
env: Record<string, string | undefined>;
|
|
216
|
+
fetchImpl: typeof fetch;
|
|
217
|
+
signal?: AbortSignal;
|
|
218
|
+
platform?: NodeJS.Platform;
|
|
219
|
+
run?: Runner;
|
|
220
|
+
now?: () => number;
|
|
221
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
222
|
+
lockWaitMs?: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The environment credential wins over a saved login. Neither reaches argv, help, or a result. */
|
|
201
226
|
declare const TOKEN_VARIABLE = "SATURNDOCS_MANAGEMENT_TOKEN";
|
|
202
227
|
interface ClientEnvironment {
|
|
203
228
|
env?: Record<string, string | undefined>;
|
|
204
229
|
/** Injected for tests; passed on as a bare function, never as a method of this object. */
|
|
205
230
|
fetchImpl?: typeof fetch;
|
|
206
231
|
signal?: AbortSignal;
|
|
232
|
+
/** Injected for tests of the saved-login path. */
|
|
233
|
+
login?: Partial<Omit<LoginEnvironment, "env" | "fetchImpl" | "signal">>;
|
|
207
234
|
}
|
|
208
235
|
/**
|
|
209
236
|
* One client per invocation, built from the global flags and the environment.
|
|
@@ -223,12 +250,24 @@ declare function coverageOfDocsDir(docsDir: string, outlinePath: string): Promis
|
|
|
223
250
|
declare function registerCoverage(program: Command): void;
|
|
224
251
|
|
|
225
252
|
declare const AUTH_METADATA: readonly CommandMetadata[];
|
|
253
|
+
interface SavedLoginCredential {
|
|
254
|
+
kind: "agent_grant";
|
|
255
|
+
store: string;
|
|
256
|
+
grant_id: string;
|
|
257
|
+
capabilities: string[];
|
|
258
|
+
access_expires_at: string;
|
|
259
|
+
idle_expires_at: string;
|
|
260
|
+
approval_expires_at: string;
|
|
261
|
+
repo_connected: boolean | null;
|
|
262
|
+
}
|
|
226
263
|
interface AuthStatus {
|
|
227
264
|
/** The site the credential resolves to, exactly as discovery returned it. */
|
|
228
265
|
current: string;
|
|
229
266
|
sites: SiteDiscovery["sites"];
|
|
230
267
|
/** One read answered. It says nothing about write or approve permission. */
|
|
231
268
|
read_verified: true;
|
|
269
|
+
/** Present for a saved login, whose permissions the server does report. */
|
|
270
|
+
credential?: SavedLoginCredential;
|
|
232
271
|
}
|
|
233
272
|
declare function authStatusOf(discovery: SiteDiscovery): AuthStatus;
|
|
234
273
|
declare function registerAuth(program: Command, _cliDir: string, environment?: ClientEnvironment): void;
|
|
@@ -262,6 +301,8 @@ declare const LINT_METADATA: readonly CommandMetadata[];
|
|
|
262
301
|
interface LintReportFinding {
|
|
263
302
|
path: string;
|
|
264
303
|
line: number | null;
|
|
304
|
+
column?: number;
|
|
305
|
+
fix?: string;
|
|
265
306
|
rule: string;
|
|
266
307
|
severity: "warning" | "error";
|
|
267
308
|
message: string;
|
|
@@ -339,19 +380,38 @@ interface BrokenLink {
|
|
|
339
380
|
*/
|
|
340
381
|
declare function scanBrokenLinks(distDir: string): Promise<BrokenLink[]>;
|
|
341
382
|
|
|
383
|
+
interface ValidationIssue {
|
|
384
|
+
/** Docs-root-relative with forward slashes, or null for the bundle as a whole. */
|
|
385
|
+
path: string | null;
|
|
386
|
+
line: number | null;
|
|
387
|
+
column: number | null;
|
|
388
|
+
code: string;
|
|
389
|
+
message: string;
|
|
390
|
+
fix: string | null;
|
|
391
|
+
}
|
|
342
392
|
/**
|
|
343
|
-
* Validate a docs directory
|
|
344
|
-
* an empty list means the directory is valid. Checks performed:
|
|
393
|
+
* Validate a docs directory and report errors with available locations and a
|
|
394
|
+
* suggested fix; an empty list means the directory is valid. Checks performed:
|
|
345
395
|
* - `docs.json` loads and passes the schema.
|
|
346
396
|
* - `models.toml` (only if present) loads and passes the schema.
|
|
347
397
|
* - every navigation page resolves under the file-resolution rule.
|
|
348
398
|
* - every navigation-group `openapi` file exists and parses.
|
|
349
399
|
* - when all of the above pass: the bundle structure and semantic checks
|
|
350
|
-
* ingest runs,
|
|
351
|
-
* operation, or a
|
|
400
|
+
* ingest runs, with every page-source issue rather than ingest's first, then
|
|
401
|
+
* every internal link resolves to a page, an OpenAPI operation, or a
|
|
402
|
+
* platform route. Validate the configured and page-level icons and images.
|
|
352
403
|
*/
|
|
404
|
+
declare function validateDocsReport(docsDir: string): Promise<ValidationIssue[]>;
|
|
405
|
+
/** The same checks as `validateDocsReport`, one readable line per error. */
|
|
353
406
|
declare function validateDocs(docsDir: string): Promise<string[]>;
|
|
354
407
|
|
|
408
|
+
interface ValidateReport {
|
|
409
|
+
docs_dir: string;
|
|
410
|
+
valid: boolean;
|
|
411
|
+
errors: ValidationIssue[];
|
|
412
|
+
}
|
|
413
|
+
declare function validateReportText(report: ValidateReport): string;
|
|
414
|
+
|
|
355
415
|
/**
|
|
356
416
|
* Render a list of rows as a fixed-width, column-aligned text table with a
|
|
357
417
|
* header row and a divider. Each cell is left-aligned and padded to the widest
|
|
@@ -359,36 +419,6 @@ declare function validateDocs(docsDir: string): Promise<string[]>;
|
|
|
359
419
|
*/
|
|
360
420
|
declare function renderTable(headers: string[], rows: string[][]): string;
|
|
361
421
|
|
|
362
|
-
interface BundleArchive {
|
|
363
|
-
path: string;
|
|
364
|
-
byteLength: number;
|
|
365
|
-
sha256: string;
|
|
366
|
-
warnings: AbiViolation[];
|
|
367
|
-
cleanup(): Promise<void>;
|
|
368
|
-
}
|
|
369
|
-
declare function createBundleArchive(inputDir: string): Promise<BundleArchive>;
|
|
370
|
-
|
|
371
|
-
type JobStatus = {
|
|
372
|
-
job_id: string;
|
|
373
|
-
state: string;
|
|
374
|
-
revision_id?: string;
|
|
375
|
-
release_id?: string;
|
|
376
|
-
generation?: number;
|
|
377
|
-
error_code?: string;
|
|
378
|
-
};
|
|
379
|
-
declare function deployBundle(input: {
|
|
380
|
-
docsDir: string;
|
|
381
|
-
apiUrl: string;
|
|
382
|
-
token: string;
|
|
383
|
-
promote: boolean;
|
|
384
|
-
idempotencyKey?: string;
|
|
385
|
-
pollIntervalMs?: number;
|
|
386
|
-
timeoutMs?: number;
|
|
387
|
-
fetchImpl?: typeof fetch;
|
|
388
|
-
onState?: (status: JobStatus) => void;
|
|
389
|
-
onWarning?: (warning: AbiViolation) => void;
|
|
390
|
-
}): Promise<JobStatus>;
|
|
391
|
-
|
|
392
422
|
interface InitOptions {
|
|
393
423
|
name?: string;
|
|
394
424
|
primary?: string;
|
|
@@ -402,6 +432,8 @@ interface InitResult {
|
|
|
402
432
|
docsDir: string;
|
|
403
433
|
config: DocsConfig;
|
|
404
434
|
extraction?: BrandExtraction;
|
|
435
|
+
/** Docs-root-relative paths of every file written, with forward slashes. */
|
|
436
|
+
files: string[];
|
|
405
437
|
}
|
|
406
438
|
declare function scaffoldDocsProject(dir?: string, options?: InitOptions, dependencies?: InitDependencies): Promise<InitResult>;
|
|
407
439
|
declare function buildDocsConfig(input: {
|
|
@@ -412,4 +444,4 @@ declare function buildDocsConfig(input: {
|
|
|
412
444
|
favicon?: string;
|
|
413
445
|
}): DocsConfig;
|
|
414
446
|
|
|
415
|
-
export { AUTH_METADATA, type AuthStatus, type BrokenLink,
|
|
447
|
+
export { AUTH_METADATA, type AuthStatus, type BrokenLink, COMMAND_GROUPS, COMMAND_GROUP_NAMES, COVERAGE_METADATA, CliError, type ClientEnvironment, type CommandGroup, type CreateEnvironment, type GlobalOptions, type InitOptions, type InitResult, type InterruptHandle, LINT_METADATA, type LintReport, type LintReportFinding, MANAGE_METADATA, NAV_METADATA, type NavResult, PAGES_METADATA, REQUESTS_CREATE_METADATA, REQUESTS_METADATA, type RegisterGroup, type ResolvedPage, type ResultContext, type ResultWriter, SCHEMA_METADATA, SITES_METADATA, STATUS_METADATA, STDIN_BYTE_CEILING, TOKEN_VARIABLE, type TextInputFlags, type ValidateReport, type ValidationIssue, applyCommandHelp, applyGlobalFlags, applyGlobalFlagsDeep, applyOutlineNavigation, asCliError, authStatusOf, buildDocsConfig, clientError, clientFor, collectPageEntries, coverageOfDocsDir, createResultWriter, failureResult, findCommandGroup, findWebDir, findWorkspaceRoot, helpBody, installInterrupt, interruptSignal, interrupted, invalidInput, lintDocsDir, pageUrl, pagesLimitations, readTextInput, registerAuth, registerCoverage, registerLint, registerNav, registerPages, registerRequests, registerRequestsCreate, registerSchema, registerSites, registerStatus, renderTable, requestedSite, resolveGlobalOptions, resolvePageFile, scaffoldDocsProject, scanBrokenLinks, schemaDocument, selectCommandGroup, statusText, successResult, validateDocs, validateDocsReport, validateReportText, wantsJson };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COVERAGE_METADATA,
|
|
3
|
+
coverageOfDocsDir,
|
|
4
|
+
registerCoverage
|
|
5
|
+
} from "./chunk-VDGVERLX.js";
|
|
1
6
|
import {
|
|
2
7
|
BrandFetcher,
|
|
3
8
|
DEFAULT_PRIMARY_COLOR,
|
|
@@ -19,102 +24,86 @@ import {
|
|
|
19
24
|
scaffoldDocsProject,
|
|
20
25
|
scoreColorCandidates,
|
|
21
26
|
selectLogoAssets
|
|
22
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3X2NBWZN.js";
|
|
23
28
|
import {
|
|
24
29
|
collectPageEntries,
|
|
25
30
|
pageUrl,
|
|
26
31
|
resolvePageFile,
|
|
27
|
-
validateDocs
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from "./chunk-D3CLXV7D.js";
|
|
32
|
-
import {
|
|
33
|
-
createBundleArchive
|
|
34
|
-
} from "./chunk-O72DR5FK.js";
|
|
35
|
-
import {
|
|
36
|
-
scanBrokenLinks
|
|
37
|
-
} from "./chunk-WHNL6UYJ.js";
|
|
38
|
-
import {
|
|
39
|
-
findWebDir,
|
|
40
|
-
findWorkspaceRoot
|
|
41
|
-
} from "./chunk-VXEUNRVA.js";
|
|
32
|
+
validateDocs,
|
|
33
|
+
validateDocsReport,
|
|
34
|
+
validateReportText
|
|
35
|
+
} from "./chunk-WMS6FUKK.js";
|
|
42
36
|
import {
|
|
43
37
|
renderTable
|
|
44
38
|
} from "./chunk-J6P3VGGE.js";
|
|
45
|
-
import
|
|
39
|
+
import {
|
|
40
|
+
AUTH_METADATA,
|
|
41
|
+
authStatusOf,
|
|
42
|
+
registerAuth
|
|
43
|
+
} from "./chunk-WXLJZ7RD.js";
|
|
46
44
|
import {
|
|
47
45
|
PAGES_METADATA,
|
|
48
46
|
pagesLimitations,
|
|
49
47
|
registerPages
|
|
50
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-PU37LVIF.js";
|
|
51
49
|
import {
|
|
52
50
|
STATUS_METADATA,
|
|
53
51
|
registerStatus,
|
|
54
52
|
statusText
|
|
55
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-32ATWMIS.js";
|
|
56
54
|
import {
|
|
57
55
|
SITES_METADATA,
|
|
58
56
|
registerSites,
|
|
59
57
|
requestedSite
|
|
60
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-BOWRQKXR.js";
|
|
61
59
|
import {
|
|
62
60
|
NAV_METADATA,
|
|
63
61
|
applyOutlineNavigation,
|
|
64
62
|
registerNav
|
|
65
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-YPWPLIEZ.js";
|
|
66
64
|
import {
|
|
67
65
|
LINT_METADATA,
|
|
68
66
|
lintDocsDir,
|
|
69
67
|
registerLint
|
|
70
|
-
} from "./chunk-
|
|
71
|
-
import
|
|
72
|
-
COVERAGE_METADATA,
|
|
73
|
-
coverageOfDocsDir,
|
|
74
|
-
registerCoverage
|
|
75
|
-
} from "./chunk-WUPP3THV.js";
|
|
76
|
-
import "./chunk-56U46JVN.js";
|
|
68
|
+
} from "./chunk-TEYHAN2L.js";
|
|
69
|
+
import "./chunk-YGVC4N4V.js";
|
|
77
70
|
import {
|
|
78
71
|
MANAGE_METADATA
|
|
79
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RKM7YWPD.js";
|
|
80
73
|
import {
|
|
81
74
|
REQUESTS_CREATE_METADATA,
|
|
82
75
|
REQUESTS_METADATA,
|
|
83
76
|
registerRequests,
|
|
84
77
|
registerRequestsCreate
|
|
85
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-3EW6ZPL6.js";
|
|
86
79
|
import {
|
|
87
80
|
STDIN_BYTE_CEILING,
|
|
88
81
|
readTextInput
|
|
89
|
-
} from "./chunk-
|
|
90
|
-
import "./chunk-
|
|
91
|
-
import "./chunk-
|
|
92
|
-
import "./chunk-
|
|
82
|
+
} from "./chunk-6EKGBIUR.js";
|
|
83
|
+
import "./chunk-5ZYUBLEH.js";
|
|
84
|
+
import "./chunk-W3FZTCKV.js";
|
|
85
|
+
import "./chunk-E3G56DR2.js";
|
|
93
86
|
import {
|
|
94
87
|
SCHEMA_METADATA,
|
|
95
88
|
registerSchema,
|
|
96
89
|
schemaDocument
|
|
97
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-IJOYWJVM.js";
|
|
98
91
|
import {
|
|
99
92
|
COMMAND_GROUPS,
|
|
100
93
|
COMMAND_GROUP_NAMES,
|
|
101
94
|
findCommandGroup,
|
|
102
95
|
selectCommandGroup
|
|
103
|
-
} from "./chunk-
|
|
104
|
-
import
|
|
105
|
-
AUTH_METADATA,
|
|
106
|
-
authStatusOf,
|
|
107
|
-
registerAuth
|
|
108
|
-
} from "./chunk-K5YY6NSF.js";
|
|
96
|
+
} from "./chunk-HBSJ4Z4S.js";
|
|
97
|
+
import "./chunk-IWIVHHZI.js";
|
|
109
98
|
import {
|
|
110
99
|
TOKEN_VARIABLE,
|
|
111
100
|
asCliError,
|
|
112
101
|
clientFor
|
|
113
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-FUZE54DG.js";
|
|
114
103
|
import {
|
|
115
104
|
installInterrupt,
|
|
116
105
|
interruptSignal
|
|
117
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-T3MCJYSF.js";
|
|
118
107
|
import {
|
|
119
108
|
applyCommandHelp,
|
|
120
109
|
helpBody
|
|
@@ -127,11 +116,87 @@ import {
|
|
|
127
116
|
createResultWriter,
|
|
128
117
|
failureResult,
|
|
129
118
|
interrupted,
|
|
130
|
-
invalidInput,
|
|
119
|
+
invalidInput2 as invalidInput,
|
|
131
120
|
resolveGlobalOptions,
|
|
132
121
|
successResult,
|
|
133
122
|
wantsJson
|
|
134
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-3KCCCMQY.js";
|
|
124
|
+
|
|
125
|
+
// src/lib/workspace.ts
|
|
126
|
+
import { existsSync } from "fs";
|
|
127
|
+
import { dirname, join } from "path";
|
|
128
|
+
function findWorkspaceRoot(startDir) {
|
|
129
|
+
let dir = startDir;
|
|
130
|
+
for (; ; ) {
|
|
131
|
+
if (existsSync(join(dir, "pnpm-workspace.yaml")) && existsSync(join(dir, "apps", "web"))) {
|
|
132
|
+
return dir;
|
|
133
|
+
}
|
|
134
|
+
const parent = dirname(dir);
|
|
135
|
+
if (parent === dir) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
`Could not locate the SaturnDocs workspace root (a directory with pnpm-workspace.yaml and apps/web) at or above ${startDir}.`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
dir = parent;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function findWebDir(startDir) {
|
|
144
|
+
return join(findWorkspaceRoot(startDir), "apps", "web");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/lib/links.ts
|
|
148
|
+
import { statSync } from "fs";
|
|
149
|
+
import { readFile } from "fs/promises";
|
|
150
|
+
import { dirname as dirname2, extname, join as join2, relative } from "path";
|
|
151
|
+
import fg from "fast-glob";
|
|
152
|
+
function isInternalLink(href) {
|
|
153
|
+
if (href === "") return false;
|
|
154
|
+
if (href.startsWith("#")) return false;
|
|
155
|
+
if (href.startsWith("//")) return false;
|
|
156
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(href)) return false;
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
function candidatePaths(distDir, htmlFile, href) {
|
|
160
|
+
const path = href.split("#")[0].split("?")[0];
|
|
161
|
+
if (path === "") return [];
|
|
162
|
+
const base = path.startsWith("/") ? join2(distDir, path) : join2(dirname2(htmlFile), path);
|
|
163
|
+
if (path.endsWith("/")) {
|
|
164
|
+
return [join2(base, "index.html")];
|
|
165
|
+
}
|
|
166
|
+
if (extname(base) !== "") {
|
|
167
|
+
return [base];
|
|
168
|
+
}
|
|
169
|
+
return [base, `${base}.html`, join2(base, "index.html")];
|
|
170
|
+
}
|
|
171
|
+
async function scanBrokenLinks(distDir) {
|
|
172
|
+
const htmlFiles = await fg("**/*.html", { cwd: distDir, absolute: true });
|
|
173
|
+
const attrRe = /(?:href|src)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;
|
|
174
|
+
const seen = /* @__PURE__ */ new Set();
|
|
175
|
+
const misses = [];
|
|
176
|
+
for (const htmlFile of htmlFiles) {
|
|
177
|
+
const html = await readFile(htmlFile, "utf8");
|
|
178
|
+
const source = relative(distDir, htmlFile);
|
|
179
|
+
let match;
|
|
180
|
+
while ((match = attrRe.exec(html)) !== null) {
|
|
181
|
+
const href = (match[1] ?? match[2] ?? "").trim();
|
|
182
|
+
if (!isInternalLink(href)) continue;
|
|
183
|
+
const candidates = candidatePaths(distDir, htmlFile, href);
|
|
184
|
+
if (candidates.length === 0) continue;
|
|
185
|
+
if (candidates.some((candidate) => {
|
|
186
|
+
try {
|
|
187
|
+
return statSync(candidate, { throwIfNoEntry: false })?.isFile() === true;
|
|
188
|
+
} catch {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
})) continue;
|
|
192
|
+
const key = `${source}\0${href}`;
|
|
193
|
+
if (seen.has(key)) continue;
|
|
194
|
+
seen.add(key);
|
|
195
|
+
misses.push({ source, href });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return misses;
|
|
199
|
+
}
|
|
135
200
|
export {
|
|
136
201
|
AUTH_METADATA,
|
|
137
202
|
BrandFetcher,
|
|
@@ -163,9 +228,7 @@ export {
|
|
|
163
228
|
collectPageEntries,
|
|
164
229
|
colorToHex,
|
|
165
230
|
coverageOfDocsDir,
|
|
166
|
-
createBundleArchive,
|
|
167
231
|
createResultWriter,
|
|
168
|
-
deployBundle,
|
|
169
232
|
deriveDocsJson,
|
|
170
233
|
extensionForContentType,
|
|
171
234
|
extractBrandFromUrl,
|
|
@@ -215,5 +278,7 @@ export {
|
|
|
215
278
|
statusText,
|
|
216
279
|
successResult,
|
|
217
280
|
validateDocs,
|
|
281
|
+
validateDocsReport,
|
|
282
|
+
validateReportText,
|
|
218
283
|
wantsJson
|
|
219
284
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AGENT_INSTRUCTIONS,
|
|
2
3
|
buildDocsConfig,
|
|
3
4
|
printExtractionReport,
|
|
4
5
|
registerInit,
|
|
5
6
|
scaffoldDocsProject
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-3X2NBWZN.js";
|
|
8
|
+
import "./chunk-E3G56DR2.js";
|
|
9
|
+
import "./chunk-3KCCCMQY.js";
|
|
9
10
|
export {
|
|
11
|
+
AGENT_INSTRUCTIONS,
|
|
10
12
|
buildDocsConfig,
|
|
11
13
|
printExtractionReport,
|
|
12
14
|
registerInit,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
LINT_METADATA,
|
|
3
3
|
lintDocsDir,
|
|
4
4
|
registerLint
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-TEYHAN2L.js";
|
|
6
|
+
import "./chunk-YGVC4N4V.js";
|
|
7
7
|
import "./chunk-M2BZEDAS.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3KCCCMQY.js";
|
|
9
9
|
export {
|
|
10
10
|
LINT_METADATA,
|
|
11
11
|
lintDocsDir,
|