saturndocs 0.1.2 → 0.2.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-FRCFGNYT.js → auth-DUYYFNEZ.js} +4 -4
- package/dist/{brokenLinks-TTOBP4P7.js → brokenLinks-E364XYH3.js} +1 -1
- package/dist/{chunk-SABK3R2P.js → chunk-2RZEC3VH.js} +132 -136
- package/dist/{chunk-KGJESHJC.js → chunk-2YTD2XNI.js} +1 -1
- package/dist/{chunk-QLFODLVN.js → chunk-4J33CCAC.js} +18 -15
- package/dist/{chunk-STCCGFKC.js → chunk-4ORVQCHY.js} +1 -1
- package/dist/chunk-56U46JVN.js +28 -0
- package/dist/chunk-6JGAA5TF.js +86 -0
- package/dist/{chunk-GYRVGWDM.js → chunk-ADZOBRZE.js} +88 -6
- package/dist/chunk-D3CLXV7D.js +131 -0
- package/dist/{chunk-5KX4ZK5E.js → chunk-DBMFJXKP.js} +11 -5
- package/dist/chunk-EB7RWFQA.js +3821 -0
- package/dist/{chunk-R3X2DPFF.js → chunk-FGKHDJOC.js} +133 -4
- package/dist/{chunk-3V753MRI.js → chunk-GGGL4O7Z.js} +2 -2
- package/dist/{chunk-OZWTXMO3.js → chunk-GLI3OUYL.js} +57 -4
- package/dist/{chunk-3P2OFTXR.js → chunk-K5YY6NSF.js} +2 -2
- package/dist/{chunk-TKISMN3P.js → chunk-KOJJUISB.js} +2 -2
- package/dist/chunk-O72DR5FK.js +152 -0
- package/dist/{chunk-U7PKMSB3.js → chunk-QF2ADHQZ.js} +4 -4
- package/dist/{chunk-S45UWCML.js → chunk-SVDVBZPA.js} +9 -9
- package/dist/{chunk-CMNX5DLQ.js → chunk-W3GKH5DY.js} +2 -2
- package/dist/{chunk-N7QPZMLP.js → chunk-WBI4EI3D.js} +1 -1
- package/dist/{chunk-OEAEX5YW.js → chunk-WHNL6UYJ.js} +8 -2
- package/dist/chunk-WUPP3THV.js +87 -0
- package/dist/chunk-YSFP37B7.js +76 -0
- package/dist/{chunk-XO4CUC7V.js → chunk-Z5CBPJ2L.js} +3 -3
- package/dist/cli.js +3 -3
- package/dist/coverage-EBWULNQQ.js +15 -0
- package/dist/deploy-QUVLOGII.js +13 -0
- package/dist/dist-XISZDQTR.js +120 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +66 -38
- package/dist/{init-7T5TEPBH.js → init-PI4VTG7V.js} +2 -2
- package/dist/lint-SXBP37G3.js +13 -0
- package/dist/{manage-MKH27U3B.js → manage-OB6DQK3Q.js} +2 -2
- package/dist/nav-R4OORY2G.js +14 -0
- package/dist/{openapiCheck-KGBQJTIQ.js → openapiCheck-X2QQGETY.js} +6 -6
- package/dist/{pages-HIPXRLSY.js → pages-MKFZAVGI.js} +5 -5
- package/dist/{read-DMSJUEDA.js → read-VECMKHBW.js} +4 -4
- package/dist/{read-ZEVUZNNB.js → read-WWOMA67R.js} +4 -4
- package/dist/requests-A7WC3B4M.js +13 -0
- package/dist/{schema-XJUEZSIW.js → schema-NKOXZHQH.js} +3 -3
- package/dist/{sites-I4WI2MPG.js → sites-XMMGWPY2.js} +4 -4
- package/dist/{status-7R3NOI5H.js → status-SYIUUSSU.js} +4 -4
- package/dist/{suggestions-4WFQ3APX.js → suggestions-GX5CQK26.js} +4 -4
- package/dist/{validate-VXL4PL42.js → validate-D4I3DY2W.js} +5 -3
- package/package.json +6 -5
- package/dist/chunk-I6U4V7B4.js +0 -1552
- package/dist/deploy-QU7DCKWU.js +0 -11
- package/dist/requests-H5MIGBIS.js +0 -13
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
AUTH_METADATA,
|
|
3
3
|
authStatusOf,
|
|
4
4
|
registerAuth
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-K5YY6NSF.js";
|
|
6
|
+
import "./chunk-KOJJUISB.js";
|
|
7
|
+
import "./chunk-2YTD2XNI.js";
|
|
8
8
|
import "./chunk-M2BZEDAS.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ADZOBRZE.js";
|
|
10
10
|
export {
|
|
11
11
|
AUTH_METADATA,
|
|
12
12
|
authStatusOf,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadDocsConfig
|
|
3
|
-
} from "./chunk-R3X2DPFF.js";
|
|
4
1
|
import {
|
|
5
2
|
messageOf
|
|
6
3
|
} from "./chunk-VNYDYHXM.js";
|
|
4
|
+
import {
|
|
5
|
+
loadDocsConfig
|
|
6
|
+
} from "./chunk-FGKHDJOC.js";
|
|
7
7
|
|
|
8
8
|
// src/commands/init.ts
|
|
9
9
|
import { existsSync } from "fs";
|
|
@@ -52,54 +52,54 @@ var BrandFetcher = class {
|
|
|
52
52
|
throw new Error(`request budget exceeded (${this.maxRequests})`);
|
|
53
53
|
}
|
|
54
54
|
this.count += 1;
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
57
|
+
try {
|
|
58
|
+
const fetchImpl = this.fetchImpl;
|
|
59
|
+
const response = await fetchImpl(url, {
|
|
60
|
+
redirect: "manual",
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
headers: {
|
|
63
|
+
"user-agent": USER_AGENT,
|
|
64
|
+
accept: options.accept ?? "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const location = response.headers.get("location");
|
|
68
|
+
if (isRedirect(response.status) && location) {
|
|
69
|
+
void response.body?.cancel().catch(() => void 0);
|
|
70
|
+
if (redirects >= this.maxRedirects) {
|
|
71
|
+
throw new Error(`redirect limit exceeded (${this.maxRedirects})`);
|
|
72
|
+
}
|
|
73
|
+
const next = new URL(location, url);
|
|
74
|
+
if (next.protocol !== "http:" && next.protocol !== "https:") {
|
|
75
|
+
throw new Error(`redirect target is not http/https: ${next.href}`);
|
|
76
|
+
}
|
|
77
|
+
await this.validate(next);
|
|
78
|
+
redirects += 1;
|
|
79
|
+
url = next;
|
|
80
|
+
continue;
|
|
60
81
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
throw new Error(`
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
void response.body?.cancel().catch(() => void 0);
|
|
84
|
+
throw new Error(`fetch failed for ${url.href}: HTTP ${response.status}`);
|
|
64
85
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
const maxBytes = options.maxBytes ?? DEFAULT_PAGE_MAX_BYTES;
|
|
87
|
+
const body = await readResponseBytes(
|
|
88
|
+
response,
|
|
89
|
+
maxBytes,
|
|
90
|
+
options.truncate === true
|
|
91
|
+
);
|
|
92
|
+
const contentType = response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase();
|
|
93
|
+
return {
|
|
94
|
+
url: url.toString(),
|
|
95
|
+
status: response.status,
|
|
96
|
+
contentType,
|
|
97
|
+
bytes: body.bytes,
|
|
98
|
+
truncated: body.truncated
|
|
99
|
+
};
|
|
100
|
+
} finally {
|
|
101
|
+
clearTimeout(timeout);
|
|
72
102
|
}
|
|
73
|
-
const maxBytes = options.maxBytes ?? DEFAULT_PAGE_MAX_BYTES;
|
|
74
|
-
const body = await readResponseBytes(
|
|
75
|
-
response,
|
|
76
|
-
maxBytes,
|
|
77
|
-
options.truncate === true
|
|
78
|
-
);
|
|
79
|
-
const contentType = response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase();
|
|
80
|
-
return {
|
|
81
|
-
url: url.toString(),
|
|
82
|
-
status: response.status,
|
|
83
|
-
contentType,
|
|
84
|
-
bytes: body.bytes,
|
|
85
|
-
truncated: body.truncated
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async fetchOnce(url, accept) {
|
|
90
|
-
const controller = new AbortController();
|
|
91
|
-
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
92
|
-
try {
|
|
93
|
-
return await this.fetchImpl(url, {
|
|
94
|
-
redirect: "manual",
|
|
95
|
-
signal: controller.signal,
|
|
96
|
-
headers: {
|
|
97
|
-
"user-agent": USER_AGENT,
|
|
98
|
-
accept: accept ?? "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
} finally {
|
|
102
|
-
clearTimeout(timeout);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
async validate(url) {
|
|
@@ -2131,6 +2131,86 @@ function cleanOption(value) {
|
|
|
2131
2131
|
function messageOf22(error) {
|
|
2132
2132
|
return error instanceof Error ? error.message : String(error);
|
|
2133
2133
|
}
|
|
2134
|
+
function starterFonts() {
|
|
2135
|
+
return {
|
|
2136
|
+
body: { family: "Instrument Sans", weights: [400, 500, 600] },
|
|
2137
|
+
heading: { family: "Bricolage Grotesque", weights: [500, 600, 700] },
|
|
2138
|
+
mono: { family: "IBM Plex Mono", weights: [400, 500] }
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
var yamlString = (value) => JSON.stringify(value);
|
|
2142
|
+
function indexPageMdx(name, description) {
|
|
2143
|
+
return `---
|
|
2144
|
+
title: ${yamlString(`Welcome to ${name}`)}
|
|
2145
|
+
description: ${yamlString(description)}
|
|
2146
|
+
---
|
|
2147
|
+
|
|
2148
|
+
<Note>
|
|
2149
|
+
This site was scaffolded with SaturnDocs. Edit \`docs.json\` to update site metadata and navigation.
|
|
2150
|
+
</Note>
|
|
2151
|
+
|
|
2152
|
+
## Start here
|
|
2153
|
+
|
|
2154
|
+
<Columns cols={2}>
|
|
2155
|
+
<Card title="Write pages" icon="file-text">
|
|
2156
|
+
Add MDX files under \`pages/\`, then list them in \`docs.json\`.
|
|
2157
|
+
</Card>
|
|
2158
|
+
<Card title="Preview locally" icon="monitor">
|
|
2159
|
+
Run \`saturndocs dev\` to open the docs site while you edit.
|
|
2160
|
+
</Card>
|
|
2161
|
+
</Columns>
|
|
2162
|
+
`;
|
|
2163
|
+
}
|
|
2164
|
+
function quickstartPageMdx(name) {
|
|
2165
|
+
return `---
|
|
2166
|
+
title: Quickstart
|
|
2167
|
+
description: ${yamlString(`Start editing ${name}.`)}
|
|
2168
|
+
---
|
|
2169
|
+
|
|
2170
|
+
## Run the site
|
|
2171
|
+
|
|
2172
|
+
\`\`\`sh
|
|
2173
|
+
saturndocs dev
|
|
2174
|
+
\`\`\`
|
|
2175
|
+
|
|
2176
|
+
## Edit content
|
|
2177
|
+
|
|
2178
|
+
Update \`pages/index.mdx\`, then add more files under \`pages/\`. Every page that should appear in the sidebar must be listed in \`docs.json\`.
|
|
2179
|
+
|
|
2180
|
+
\`\`\`json title="docs.json"
|
|
2181
|
+
{
|
|
2182
|
+
"navigation": {
|
|
2183
|
+
"groups": [
|
|
2184
|
+
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
2185
|
+
]
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
\`\`\`
|
|
2189
|
+
|
|
2190
|
+
## Use built-in components
|
|
2191
|
+
|
|
2192
|
+
\`\`\`mdx
|
|
2193
|
+
<Note>
|
|
2194
|
+
Use notes for short callouts.
|
|
2195
|
+
</Note>
|
|
2196
|
+
|
|
2197
|
+
<Steps>
|
|
2198
|
+
<Step title="Create a page">
|
|
2199
|
+
Save a new MDX file in the pages directory.
|
|
2200
|
+
</Step>
|
|
2201
|
+
<Step title="Add it to navigation">
|
|
2202
|
+
Add the page slug to docs.json.
|
|
2203
|
+
</Step>
|
|
2204
|
+
</Steps>
|
|
2205
|
+
\`\`\`
|
|
2206
|
+
`;
|
|
2207
|
+
}
|
|
2208
|
+
function starterPages(name, description) {
|
|
2209
|
+
return [
|
|
2210
|
+
{ path: "pages/index.mdx", content: indexPageMdx(name, description) },
|
|
2211
|
+
{ path: "pages/quickstart.mdx", content: quickstartPageMdx(name) }
|
|
2212
|
+
];
|
|
2213
|
+
}
|
|
2134
2214
|
|
|
2135
2215
|
// src/commands/init.ts
|
|
2136
2216
|
import pc from "picocolors";
|
|
@@ -2187,13 +2267,6 @@ function buildDocsConfig(input) {
|
|
|
2187
2267
|
if (input.favicon) config.favicon = input.favicon;
|
|
2188
2268
|
return config;
|
|
2189
2269
|
}
|
|
2190
|
-
function starterFonts() {
|
|
2191
|
-
return {
|
|
2192
|
-
body: { family: "Instrument Sans", weights: [400, 500, 600] },
|
|
2193
|
-
heading: { family: "Bricolage Grotesque", weights: [500, 600, 700] },
|
|
2194
|
-
mono: { family: "IBM Plex Mono", weights: [400, 500] }
|
|
2195
|
-
};
|
|
2196
|
-
}
|
|
2197
2270
|
function mergeExtractedFonts(extraction) {
|
|
2198
2271
|
const fonts = starterFonts();
|
|
2199
2272
|
const body = extraction.fonts?.body;
|
|
@@ -2233,24 +2306,16 @@ function cleanOption2(value) {
|
|
|
2233
2306
|
return cleaned && cleaned.length > 0 ? cleaned : void 0;
|
|
2234
2307
|
}
|
|
2235
2308
|
async function writeScaffoldFiles(docsDir, config) {
|
|
2236
|
-
|
|
2237
|
-
await mkdir(pagesDir, { recursive: true });
|
|
2309
|
+
await mkdir(join(docsDir, "pages"), { recursive: true });
|
|
2238
2310
|
await writeFile(
|
|
2239
2311
|
join(docsDir, "docs.json"),
|
|
2240
2312
|
`${JSON.stringify(config, null, 2)}
|
|
2241
2313
|
`,
|
|
2242
2314
|
"utf8"
|
|
2243
2315
|
);
|
|
2244
|
-
|
|
2245
|
-
join(
|
|
2246
|
-
|
|
2247
|
-
"utf8"
|
|
2248
|
-
);
|
|
2249
|
-
await writeFile(
|
|
2250
|
-
join(pagesDir, "quickstart.mdx"),
|
|
2251
|
-
quickstartPageMdx(config.name),
|
|
2252
|
-
"utf8"
|
|
2253
|
-
);
|
|
2316
|
+
for (const file of starterPages(config.name, config.description ?? "")) {
|
|
2317
|
+
await writeFile(join(docsDir, file.path), file.content, "utf8");
|
|
2318
|
+
}
|
|
2254
2319
|
}
|
|
2255
2320
|
async function writeExtractedAssets(docsDir, extraction) {
|
|
2256
2321
|
const assets = [extraction.logo, extraction.favicon].filter(
|
|
@@ -2263,75 +2328,6 @@ async function writeExtractedAssets(docsDir, extraction) {
|
|
|
2263
2328
|
await writeFile(join(publicDir, asset.suggestedFilename), asset.bytes);
|
|
2264
2329
|
}
|
|
2265
2330
|
}
|
|
2266
|
-
function indexPageMdx(name, description) {
|
|
2267
|
-
return `---
|
|
2268
|
-
title: ${yamlString(`Welcome to ${name}`)}
|
|
2269
|
-
description: ${yamlString(description)}
|
|
2270
|
-
---
|
|
2271
|
-
|
|
2272
|
-
<Note>
|
|
2273
|
-
This site was scaffolded with SaturnDocs. Edit \`docs.json\` to update site metadata and navigation.
|
|
2274
|
-
</Note>
|
|
2275
|
-
|
|
2276
|
-
## Start here
|
|
2277
|
-
|
|
2278
|
-
<Columns cols={2}>
|
|
2279
|
-
<Card title="Write pages" icon="file-text">
|
|
2280
|
-
Add MDX files under \`pages/\`, then list them in \`docs.json\`.
|
|
2281
|
-
</Card>
|
|
2282
|
-
<Card title="Preview locally" icon="monitor">
|
|
2283
|
-
Run \`saturndocs dev\` to open the docs site while you edit.
|
|
2284
|
-
</Card>
|
|
2285
|
-
</Columns>
|
|
2286
|
-
`;
|
|
2287
|
-
}
|
|
2288
|
-
function quickstartPageMdx(name) {
|
|
2289
|
-
return `---
|
|
2290
|
-
title: Quickstart
|
|
2291
|
-
description: ${yamlString(`Start editing ${name}.`)}
|
|
2292
|
-
---
|
|
2293
|
-
|
|
2294
|
-
## Run the site
|
|
2295
|
-
|
|
2296
|
-
\`\`\`sh
|
|
2297
|
-
saturndocs dev
|
|
2298
|
-
\`\`\`
|
|
2299
|
-
|
|
2300
|
-
## Edit content
|
|
2301
|
-
|
|
2302
|
-
Update \`pages/index.mdx\`, then add more files under \`pages/\`. Every page that should appear in the sidebar must be listed in \`docs.json\`.
|
|
2303
|
-
|
|
2304
|
-
\`\`\`json title="docs.json"
|
|
2305
|
-
{
|
|
2306
|
-
"navigation": {
|
|
2307
|
-
"groups": [
|
|
2308
|
-
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
2309
|
-
]
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
\`\`\`
|
|
2313
|
-
|
|
2314
|
-
## Use built-in components
|
|
2315
|
-
|
|
2316
|
-
\`\`\`mdx
|
|
2317
|
-
<Note>
|
|
2318
|
-
Use notes for short callouts.
|
|
2319
|
-
</Note>
|
|
2320
|
-
|
|
2321
|
-
<Steps>
|
|
2322
|
-
<Step title="Create a page">
|
|
2323
|
-
Save a new MDX file in the pages directory.
|
|
2324
|
-
</Step>
|
|
2325
|
-
<Step title="Add it to navigation">
|
|
2326
|
-
Add the page slug to docs.json.
|
|
2327
|
-
</Step>
|
|
2328
|
-
</Steps>
|
|
2329
|
-
\`\`\`
|
|
2330
|
-
`;
|
|
2331
|
-
}
|
|
2332
|
-
function yamlString(value) {
|
|
2333
|
-
return JSON.stringify(value);
|
|
2334
|
-
}
|
|
2335
2331
|
function printExtractionReport(result) {
|
|
2336
2332
|
const extraction = result.extraction;
|
|
2337
2333
|
if (!extraction) return;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
// src/adapter/registry.ts
|
|
2
2
|
var COMMAND_GROUPS = Object.freeze([
|
|
3
|
-
{ name: "manage", summary: "Call one management operation through the dashboard API", renderer: false, load: () => import("./manage-
|
|
4
|
-
{ name: "requests", summary: "Documentation requests and the conversations behind them", renderer: false, load: () => import("./requests-
|
|
5
|
-
{ name: "suggestions", summary: "Read a site's suggestions and diff the content they carry", renderer: false, load: () => import("./suggestions-
|
|
6
|
-
{ name: "schema", summary: "Print this CLI's own command metadata, locally", renderer: false, load: () => import("./schema-
|
|
7
|
-
{ name: "auth", summary: "Check the management credential in the environment", renderer: false, load: () => import("./auth-
|
|
8
|
-
{ name: "sites", summary: "Discover and inspect the sites this credential reaches", renderer: false, load: () => import("./sites-
|
|
9
|
-
{ name: "pages", summary: "Read the published pages of the release readers are seeing", renderer: false, load: () => import("./pages-
|
|
10
|
-
{ name: "releases", summary: "Read this site's release history and one release by id", renderer: false, load: () => import("./read-
|
|
11
|
-
{ name: "status", summary: "One bounded briefing on a site, section by section", renderer: false, load: () => import("./status-
|
|
12
|
-
{ name: "activity", summary: "Read what the platform did, and one job by id", renderer: false, load: () => import("./read-
|
|
13
|
-
{ name: "
|
|
14
|
-
{ name: "
|
|
3
|
+
{ name: "manage", summary: "Call one management operation through the dashboard API", renderer: false, load: () => import("./manage-OB6DQK3Q.js").then((m) => m.registerManage), metadata: () => import("./manage-OB6DQK3Q.js").then((m) => m.MANAGE_METADATA) },
|
|
4
|
+
{ name: "requests", summary: "Documentation requests and the conversations behind them", renderer: false, load: () => import("./requests-A7WC3B4M.js").then((m) => m.registerRequests), metadata: () => import("./requests-A7WC3B4M.js").then((m) => m.REQUESTS_METADATA) },
|
|
5
|
+
{ name: "suggestions", summary: "Read a site's suggestions and diff the content they carry", renderer: false, load: () => import("./suggestions-GX5CQK26.js").then((m) => m.registerSuggestions), metadata: () => import("./suggestions-GX5CQK26.js").then((m) => m.SUGGESTIONS_METADATA) },
|
|
6
|
+
{ name: "schema", summary: "Print this CLI's own command metadata, locally", renderer: false, load: () => import("./schema-NKOXZHQH.js").then((m) => m.registerSchema), metadata: () => import("./schema-NKOXZHQH.js").then((m) => m.SCHEMA_METADATA) },
|
|
7
|
+
{ name: "auth", summary: "Check the management credential in the environment", renderer: false, load: () => import("./auth-DUYYFNEZ.js").then((m) => m.registerAuth), metadata: () => import("./auth-DUYYFNEZ.js").then((m) => m.AUTH_METADATA) },
|
|
8
|
+
{ name: "sites", summary: "Discover and inspect the sites this credential reaches", renderer: false, load: () => import("./sites-XMMGWPY2.js").then((m) => m.registerSites), metadata: () => import("./sites-XMMGWPY2.js").then((m) => m.SITES_METADATA) },
|
|
9
|
+
{ name: "pages", summary: "Read the published pages of the release readers are seeing", renderer: false, load: () => import("./pages-MKFZAVGI.js").then((m) => m.registerPages), metadata: () => import("./pages-MKFZAVGI.js").then((m) => m.PAGES_METADATA) },
|
|
10
|
+
{ name: "releases", summary: "Read this site's release history and one release by id", renderer: false, load: () => import("./read-WWOMA67R.js").then((m) => m.registerReleases), metadata: () => import("./read-WWOMA67R.js").then((m) => m.RELEASES_METADATA) },
|
|
11
|
+
{ name: "status", summary: "One bounded briefing on a site, section by section", renderer: false, load: () => import("./status-SYIUUSSU.js").then((m) => m.registerStatus), metadata: () => import("./status-SYIUUSSU.js").then((m) => m.STATUS_METADATA) },
|
|
12
|
+
{ name: "activity", summary: "Read what the platform did, and one job by id", renderer: false, load: () => import("./read-VECMKHBW.js").then((m) => m.registerActivity), metadata: () => import("./read-VECMKHBW.js").then((m) => m.ACTIVITY_METADATA) },
|
|
13
|
+
{ name: "nav", summary: "Rewrite docs.json navigation from an approved outline", renderer: false, load: () => import("./nav-R4OORY2G.js").then((m) => m.registerNav), metadata: () => import("./nav-R4OORY2G.js").then((m) => m.NAV_METADATA) },
|
|
14
|
+
{ name: "lint", summary: "Content lint and the known-pitfalls catalog over every page; exits 2 when any finding is an error", renderer: false, load: () => import("./lint-SXBP37G3.js").then((m) => m.registerLint), metadata: () => import("./lint-SXBP37G3.js").then((m) => m.LINT_METADATA) },
|
|
15
|
+
{ name: "coverage", summary: "Check local pages against an approved outline", renderer: false, load: () => import("./coverage-EBWULNQQ.js").then((m) => m.registerCoverage), metadata: () => import("./coverage-EBWULNQQ.js").then((m) => m.COVERAGE_METADATA) },
|
|
16
|
+
{ name: "init", summary: "Scaffold a docs project", renderer: true, load: () => import("./init-PI4VTG7V.js").then((m) => m.registerInit) },
|
|
17
|
+
{ name: "validate", summary: "Validate docs.json, models.toml, page files, and OpenAPI specs", renderer: true, load: () => import("./validate-D4I3DY2W.js").then((m) => m.registerValidate) },
|
|
15
18
|
{ name: "dev", summary: "Start the Astro dev server for a docs directory", renderer: true, load: () => import("./dev-VDSDCBO2.js").then((m) => m.registerDev) },
|
|
16
19
|
{ name: "build", summary: "Build the static site for a docs directory", renderer: true, load: () => import("./build-F5PWGP57.js").then((m) => m.registerBuild) },
|
|
17
|
-
{ name: "deploy", summary: "Upload a docs bundle and follow the release job", renderer: true, load: () => import("./deploy-
|
|
18
|
-
{ name: "broken-links", summary: "Scan the built site for broken internal links", renderer: true, load: () => import("./brokenLinks-
|
|
19
|
-
{ name: "openapi-check", summary: "Parse OpenAPI specs and print an operation table", renderer: true, load: () => import("./openapiCheck-
|
|
20
|
+
{ name: "deploy", summary: "Upload a docs bundle and follow the release job", renderer: true, load: () => import("./deploy-QUVLOGII.js").then((m) => m.registerDeploy) },
|
|
21
|
+
{ name: "broken-links", summary: "Scan the built site for broken internal links", renderer: true, load: () => import("./brokenLinks-E364XYH3.js").then((m) => m.registerBrokenLinks) },
|
|
22
|
+
{ name: "openapi-check", summary: "Parse OpenAPI specs and print an operation table", renderer: true, load: () => import("./openapiCheck-X2QQGETY.js").then((m) => m.registerOpenapiCheck) }
|
|
20
23
|
]);
|
|
21
24
|
var COMMAND_GROUP_NAMES = Object.freeze(COMMAND_GROUPS.map((group) => group.name));
|
|
22
25
|
function findCommandGroup(name) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/lib/page-files.ts
|
|
2
|
+
import { readdir, readFile } from "fs/promises";
|
|
3
|
+
import { join, posix } from "path";
|
|
4
|
+
async function walk(absDir, relDir, out) {
|
|
5
|
+
let entries;
|
|
6
|
+
try {
|
|
7
|
+
entries = await readdir(absDir, { withFileTypes: true });
|
|
8
|
+
} catch (error) {
|
|
9
|
+
if (error.code === "ENOENT") return;
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
const rel = posix.join(relDir, entry.name);
|
|
14
|
+
if (entry.isDirectory()) await walk(join(absDir, entry.name), rel, out);
|
|
15
|
+
else if (entry.isFile() && /\.mdx?$/.test(entry.name)) {
|
|
16
|
+
out.push({ path: rel, content: await readFile(join(absDir, entry.name), "utf8") });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async function readPageFiles(docsDir) {
|
|
21
|
+
const out = [];
|
|
22
|
+
await walk(join(docsDir, "pages"), "pages", out);
|
|
23
|
+
return out.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
readPageFiles
|
|
28
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asCliError
|
|
3
|
+
} from "./chunk-KOJJUISB.js";
|
|
4
|
+
import {
|
|
5
|
+
applyCommandHelp
|
|
6
|
+
} from "./chunk-M2BZEDAS.js";
|
|
7
|
+
import {
|
|
8
|
+
commandMetadata,
|
|
9
|
+
createResultWriter,
|
|
10
|
+
failureResult,
|
|
11
|
+
invalidInput,
|
|
12
|
+
messageOf,
|
|
13
|
+
resolveGlobalOptions,
|
|
14
|
+
successResult
|
|
15
|
+
} from "./chunk-ADZOBRZE.js";
|
|
16
|
+
|
|
17
|
+
// src/commands/nav.ts
|
|
18
|
+
import { existsSync } from "fs";
|
|
19
|
+
import { readFile, writeFile } from "fs/promises";
|
|
20
|
+
import { resolve } from "path";
|
|
21
|
+
var NAV_METADATA = Object.freeze([
|
|
22
|
+
commandMetadata("nav", {
|
|
23
|
+
description: "Rewrite the navigation key of docs.json from an approved outline JSON file. Every other docs.json key stays as it is. Local; it needs no credential and makes no network call.",
|
|
24
|
+
target: { arguments: [{ name: "dir", required: false, description: "Docs directory that holds docs.json. Defaults to the current directory." }] },
|
|
25
|
+
effect: "Rewrites docs.json in the docs directory: replaces its navigation key and keeps every other key. Writes nothing when the outline or docs.json is invalid.",
|
|
26
|
+
output: { fields: ["groups", "pages"], ids: [], limitations: [] },
|
|
27
|
+
errors: ["invalid_input", "interrupted"],
|
|
28
|
+
examples: [
|
|
29
|
+
{ command: "saturndocs nav --outline .launch-docs/outline.json", description: "Write the navigation from the approved outline into docs.json in the current directory." },
|
|
30
|
+
{ command: "saturndocs nav --outline .launch-docs/outline.json --json", description: "The same write, reported as one result object for an agent." }
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
]);
|
|
34
|
+
async function readJson(path, label) {
|
|
35
|
+
let raw;
|
|
36
|
+
try {
|
|
37
|
+
raw = await readFile(path, "utf8");
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw invalidInput(`Cannot read ${label} at ${path}: ${messageOf(error)}`);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(raw);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw invalidInput(`${label} at ${path} is not valid JSON: ${messageOf(error)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function applyOutlineNavigation(docsDir, outlinePath) {
|
|
48
|
+
const { parseOutline, navigationFromOutline } = await import("./dist-XISZDQTR.js");
|
|
49
|
+
const docsPath = resolve(docsDir, "docs.json");
|
|
50
|
+
if (!existsSync(docsPath)) throw invalidInput(`No docs.json found in ${docsDir}. Pass a docs directory.`);
|
|
51
|
+
const config = await readJson(docsPath, "docs.json");
|
|
52
|
+
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
53
|
+
throw invalidInput(`docs.json at ${docsPath} must be a JSON object.`);
|
|
54
|
+
}
|
|
55
|
+
const rawOutline = await readJson(resolve(outlinePath), "the outline");
|
|
56
|
+
let groups;
|
|
57
|
+
try {
|
|
58
|
+
groups = navigationFromOutline(parseOutline(rawOutline));
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw invalidInput(`The outline is invalid: ${messageOf(error)}`);
|
|
61
|
+
}
|
|
62
|
+
await writeFile(docsPath, JSON.stringify({ ...config, navigation: { groups } }, null, 2) + "\n");
|
|
63
|
+
return { groups: groups.length, pages: groups.reduce((total, group) => total + group.pages.length, 0) };
|
|
64
|
+
}
|
|
65
|
+
function registerNav(program) {
|
|
66
|
+
const nav = program.command("nav").description("Rewrite docs.json navigation from an approved outline").argument("[dir]", "Docs directory that holds docs.json").requiredOption("--outline <file>", "Path to the approved outline JSON").action(async (dir, options, self) => {
|
|
67
|
+
const globals = resolveGlobalOptions(self);
|
|
68
|
+
const writer = createResultWriter({ json: globals.json });
|
|
69
|
+
const context = { command: "nav", siteId: null };
|
|
70
|
+
try {
|
|
71
|
+
const data = await applyOutlineNavigation(resolve(dir ?? process.cwd()), options.outline);
|
|
72
|
+
process.exitCode = writer.write(successResult(context, data), {
|
|
73
|
+
text: `Navigation written: ${data.groups} groups, ${data.pages} pages.`
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
process.exitCode = writer.write(failureResult(asCliError(error), context));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
applyCommandHelp(nav, NAV_METADATA[0]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
NAV_METADATA,
|
|
84
|
+
applyOutlineNavigation,
|
|
85
|
+
registerNav
|
|
86
|
+
};
|