yaakdoc 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 József Sallai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # yaakdoc
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Static, themable, and LLM-friendly API documentation generated from [Yaak](https://yaak.app) exports.
4
+
5
+ ```sh
6
+ npx yaakdoc # dev server for the Yaak export in the current folder
7
+ npx yaakdoc build # static site in dist/
8
+ ```
9
+
10
+ See the [main README](https://github.com/jozsefsallai/yaakdoc#readme) for the CLI, configuration, theming and LLM features.
11
+
12
+ ## Node API
13
+
14
+ ```ts
15
+ import { build, createDevServer, eject, init, preview } from "yaakdoc";
16
+
17
+ const { outDir, files } = await build({ cwd: "docs", overrides: { pages: "per-request" } });
18
+
19
+ const server = await createDevServer({ cwd: "docs", port: 4000 });
20
+ console.log(server.url);
21
+
22
+ await server.close();
23
+ ```
24
+
25
+ `yaakdoc` also re-exports `defineConfig`, `defineTheme` and `defineSnippet`.
26
+
27
+ `build`, `createDevServer` and `resolveContext` take `cwd`, `configFile` and `overrides` (config values that win over the config file). They also take `exportData`, the Yaak export as an object, to use instead of reading it from a file.
28
+
29
+ ### Without Vite: `yaakdoc/static`
30
+
31
+ `yaakdoc/static` is the part of the engine that doesn't need Vite. It loads the config and export, prepares the document, and writes a site with a theme that's already built. Use it to bundle yaakdoc into an environment where Vite can't run, the way the [Yaak plugin](https://github.com/jozsefsallai/yaakdoc/tree/master/packages/yaak-plugin) does.
32
+
33
+ ```ts
34
+ import {
35
+ emptyOutDir,
36
+ resolveContext,
37
+ themeFromDefinition,
38
+ withBase,
39
+ writeSite,
40
+ } from "yaakdoc/static";
41
+
42
+ const context = await resolveContext({
43
+ exportData,
44
+
45
+ overrides: {
46
+ outDir: "site",
47
+ },
48
+
49
+ // Supply the theme instead of loading it from a package or path.
50
+ resolveTheme: (spec, { themeOptions }) => {
51
+ return themeFromDefinition(myTheme, {
52
+ manifest: "/themes/my-theme/theme.ts",
53
+ themeOptions,
54
+ });
55
+ },
56
+ });
57
+
58
+ await emptyOutDir(context.config.outDir, context.root);
59
+
60
+ // ...copy the theme's prebuilt client assets into the output directory...
61
+ await writeSite(context, {
62
+ render,
63
+ assets: withBase(assets, context.config.base),
64
+ });
65
+ ```
66
+
67
+ The theme's client assets and its `render` function come from `bundleTheme(context, outDir, { base: "./" })` in the main entry. It builds the theme with Vite once, and the `"./"` base makes the client assets work under any base path.
package/bin/yaakdoc.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "../dist/cli.js";
3
+
4
+ run();
@@ -0,0 +1,446 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "$schema": {
6
+ "type": "string"
7
+ },
8
+ "export": {
9
+ "description": "Path to the Yaak export. Defaults to yaakdoc.json, then yaak.json.",
10
+ "type": "string"
11
+ },
12
+ "theme": {
13
+ "default": "kiseki",
14
+ "description": "Theme to use: a short name (`kiseki` → @yaakdoc/theme-kiseki or yaakdoc-theme-kiseki), an npm package name, or a local path (e.g. an ejected theme).",
15
+ "type": "string"
16
+ },
17
+ "themeOptions": {
18
+ "default": {},
19
+ "description": "Theme-specific options, validated by the theme.",
20
+ "type": "object",
21
+ "propertyNames": {
22
+ "type": "string"
23
+ },
24
+ "additionalProperties": {}
25
+ },
26
+ "workspace": {
27
+ "description": "Workspace id or name to document, when the export contains several.",
28
+ "type": "string"
29
+ },
30
+ "environment": {
31
+ "description": "Environment (id or name) used to resolve variables in examples. Defaults to the first shared environment; `false` disables sub environments.",
32
+ "anyOf": [
33
+ {
34
+ "type": "string"
35
+ },
36
+ {
37
+ "type": "boolean",
38
+ "const": false
39
+ }
40
+ ]
41
+ },
42
+ "environments": {
43
+ "description": "Environments readers can switch between: `\"public\"` (all shared environments) or a list of ids/names. Adds an environment switcher; `environment` is the default selection.",
44
+ "anyOf": [
45
+ {
46
+ "type": "string",
47
+ "const": "public"
48
+ },
49
+ {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ "pages": {
58
+ "default": "single",
59
+ "description": "`single`: one page with anchors. `per-request`: a page per request and folder.",
60
+ "type": "string",
61
+ "enum": [
62
+ "single",
63
+ "per-request"
64
+ ]
65
+ },
66
+ "base": {
67
+ "description": "Base path the site is served from, e.g. `/docs/`.",
68
+ "default": "/",
69
+ "type": "string"
70
+ },
71
+ "outDir": {
72
+ "default": "dist",
73
+ "description": "Output directory for `yaakdoc build`.",
74
+ "type": "string"
75
+ },
76
+ "server": {
77
+ "default": {},
78
+ "type": "object",
79
+ "properties": {
80
+ "port": {
81
+ "default": 4000,
82
+ "type": "integer",
83
+ "minimum": 0,
84
+ "maximum": 65535
85
+ },
86
+ "host": {
87
+ "default": false,
88
+ "type": [
89
+ "boolean",
90
+ "string"
91
+ ]
92
+ },
93
+ "open": {
94
+ "default": false,
95
+ "type": "boolean"
96
+ }
97
+ }
98
+ },
99
+ "branding": {
100
+ "default": {},
101
+ "type": "object",
102
+ "properties": {
103
+ "title": {
104
+ "description": "Site title. Defaults to the workspace name.",
105
+ "type": "string"
106
+ },
107
+ "description": {
108
+ "description": "Short site description (meta tags, llms.txt). Defaults to the workspace description's first paragraph.",
109
+ "type": "string"
110
+ },
111
+ "url": {
112
+ "description": "Public URL of the deployed docs. Enables absolute links, canonical URLs and sitemap.xml.",
113
+ "type": "string",
114
+ "format": "uri"
115
+ },
116
+ "logo": {
117
+ "anyOf": [
118
+ {
119
+ "type": "string",
120
+ "description": "Path or URL of the logo (used in both color modes)."
121
+ },
122
+ {
123
+ "type": "object",
124
+ "properties": {
125
+ "light": {
126
+ "description": "Logo used in light mode.",
127
+ "type": "string"
128
+ },
129
+ "dark": {
130
+ "description": "Logo used in dark mode.",
131
+ "type": "string"
132
+ },
133
+ "alt": {
134
+ "type": "string"
135
+ },
136
+ "href": {
137
+ "description": "Where clicking the logo leads. Defaults to the docs home.",
138
+ "type": "string"
139
+ },
140
+ "width": {
141
+ "type": "number"
142
+ },
143
+ "height": {
144
+ "type": "number"
145
+ }
146
+ }
147
+ }
148
+ ]
149
+ },
150
+ "favicon": {
151
+ "description": "Path or URL of the favicon.",
152
+ "type": "string"
153
+ },
154
+ "colors": {
155
+ "type": "object",
156
+ "properties": {
157
+ "primary": {
158
+ "type": "string",
159
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
160
+ },
161
+ "accent": {
162
+ "type": "string",
163
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
164
+ },
165
+ "light": {
166
+ "type": "object",
167
+ "properties": {
168
+ "primary": {
169
+ "type": "string",
170
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
171
+ },
172
+ "accent": {
173
+ "type": "string",
174
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
175
+ },
176
+ "background": {
177
+ "type": "string",
178
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
179
+ },
180
+ "foreground": {
181
+ "type": "string",
182
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
183
+ }
184
+ },
185
+ "description": "Color overrides that apply to a single color mode."
186
+ },
187
+ "dark": {
188
+ "type": "object",
189
+ "properties": {
190
+ "primary": {
191
+ "type": "string",
192
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
193
+ },
194
+ "accent": {
195
+ "type": "string",
196
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
197
+ },
198
+ "background": {
199
+ "type": "string",
200
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
201
+ },
202
+ "foreground": {
203
+ "type": "string",
204
+ "description": "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`."
205
+ }
206
+ },
207
+ "description": "Color overrides that apply to a single color mode."
208
+ }
209
+ }
210
+ },
211
+ "fonts": {
212
+ "type": "object",
213
+ "properties": {
214
+ "sans": {
215
+ "description": "CSS font-family for text, e.g. `\"Inter\", sans-serif`.",
216
+ "type": "string"
217
+ },
218
+ "mono": {
219
+ "description": "CSS font-family for code.",
220
+ "type": "string"
221
+ },
222
+ "stylesheet": {
223
+ "description": "Stylesheet URL that loads the fonts, e.g. a Google Fonts CSS URL.",
224
+ "type": "string"
225
+ }
226
+ }
227
+ },
228
+ "links": {
229
+ "default": [],
230
+ "description": "Links shown in the header.",
231
+ "type": "array",
232
+ "items": {
233
+ "type": "object",
234
+ "properties": {
235
+ "label": {
236
+ "type": "string"
237
+ },
238
+ "href": {
239
+ "type": "string"
240
+ },
241
+ "icon": {
242
+ "description": "Icon hint for themes, e.g. `github`, `discord`, `x`, `website`.",
243
+ "type": "string"
244
+ }
245
+ },
246
+ "required": [
247
+ "label",
248
+ "href"
249
+ ]
250
+ }
251
+ },
252
+ "footer": {
253
+ "description": "Footer text (Markdown).",
254
+ "type": "string"
255
+ },
256
+ "defaultColorMode": {
257
+ "default": "system",
258
+ "type": "string",
259
+ "enum": [
260
+ "system",
261
+ "light",
262
+ "dark"
263
+ ]
264
+ },
265
+ "colorModeToggle": {
266
+ "default": true,
267
+ "description": "Show the light/dark mode toggle.",
268
+ "type": "boolean"
269
+ },
270
+ "customCss": {
271
+ "description": "Path to a CSS file loaded after the theme's styles.",
272
+ "type": "string"
273
+ }
274
+ }
275
+ },
276
+ "snippets": {
277
+ "default": [
278
+ "curl",
279
+ "javascript",
280
+ "python",
281
+ "go",
282
+ "grpcurl",
283
+ "wscat"
284
+ ],
285
+ "description": "Code example generators: built-in ids (curl, javascript, python, go, grpcurl, wscat) or module paths. Each snippet only applies to the request kinds it supports.",
286
+ "type": "array",
287
+ "items": {
288
+ "type": "string"
289
+ }
290
+ },
291
+ "llms": {
292
+ "default": {},
293
+ "type": "object",
294
+ "properties": {
295
+ "enabled": {
296
+ "default": true,
297
+ "description": "Generate llms.txt and Markdown versions of pages.",
298
+ "type": "boolean"
299
+ },
300
+ "full": {
301
+ "default": true,
302
+ "description": "Also generate llms-full.txt with the complete docs.",
303
+ "type": "boolean"
304
+ },
305
+ "copyButton": {
306
+ "default": true,
307
+ "description": "Show \"Copy page\" actions.",
308
+ "type": "boolean"
309
+ },
310
+ "openIn": {
311
+ "default": [
312
+ "chatgpt",
313
+ "claude"
314
+ ],
315
+ "description": "\"Open in ...\" assistant links.",
316
+ "type": "array",
317
+ "items": {
318
+ "type": "string",
319
+ "enum": [
320
+ "chatgpt",
321
+ "claude",
322
+ "perplexity"
323
+ ]
324
+ }
325
+ }
326
+ }
327
+ },
328
+ "variables": {
329
+ "default": {},
330
+ "type": "object",
331
+ "properties": {
332
+ "resolve": {
333
+ "default": true,
334
+ "description": "Inline variable values in examples.",
335
+ "type": "boolean"
336
+ },
337
+ "hide": {
338
+ "default": [
339
+ "token",
340
+ "secret",
341
+ "password",
342
+ "passwd",
343
+ "apikey",
344
+ "api_key",
345
+ "private",
346
+ "credential",
347
+ "auth"
348
+ ],
349
+ "description": "Variable name patterns that are never inlined (case- and separator-insensitive substring match).",
350
+ "type": "array",
351
+ "items": {
352
+ "type": "string"
353
+ }
354
+ },
355
+ "show": {
356
+ "default": true,
357
+ "description": "Show the environment variables table.",
358
+ "type": "boolean"
359
+ }
360
+ }
361
+ },
362
+ "filter": {
363
+ "description": "Glob patterns over request/folder slugs (e.g. `internal/**`).",
364
+ "default": {},
365
+ "type": "object",
366
+ "properties": {
367
+ "include": {
368
+ "default": [],
369
+ "type": "array",
370
+ "items": {
371
+ "type": "string"
372
+ }
373
+ },
374
+ "exclude": {
375
+ "default": [],
376
+ "type": "array",
377
+ "items": {
378
+ "type": "string"
379
+ }
380
+ }
381
+ }
382
+ },
383
+ "runInYaak": {
384
+ "default": false,
385
+ "description": "Show a \"Run in Yaak\" button that imports the API into Yaak. Publishes a sanitized copy of the export (only documented requests, no private environments, secrets blanked).",
386
+ "anyOf": [
387
+ {
388
+ "type": "boolean"
389
+ },
390
+ {
391
+ "type": "object",
392
+ "properties": {
393
+ "name": {
394
+ "description": "Name shown in Yaak when importing. Defaults to the site title.",
395
+ "type": "string"
396
+ },
397
+ "url": {
398
+ "description": "URL of an export/spec hosted elsewhere. When omitted, yaakdoc publishes a sanitized export at `<base>yaak.json`.",
399
+ "type": "string"
400
+ }
401
+ }
402
+ }
403
+ ]
404
+ },
405
+ "head": {
406
+ "default": [],
407
+ "description": "Extra tags injected into <head> (analytics, verification meta tags...).",
408
+ "type": "array",
409
+ "items": {
410
+ "type": "object",
411
+ "properties": {
412
+ "tag": {
413
+ "type": "string",
414
+ "enum": [
415
+ "script",
416
+ "link",
417
+ "meta",
418
+ "style"
419
+ ]
420
+ },
421
+ "attrs": {
422
+ "default": {},
423
+ "type": "object",
424
+ "propertyNames": {
425
+ "type": "string"
426
+ },
427
+ "additionalProperties": {
428
+ "type": [
429
+ "string",
430
+ "boolean"
431
+ ]
432
+ }
433
+ },
434
+ "content": {
435
+ "type": "string"
436
+ }
437
+ },
438
+ "required": [
439
+ "tag"
440
+ ]
441
+ }
442
+ }
443
+ },
444
+ "title": "yaakdoc configuration",
445
+ "$id": "https://unpkg.com/yaakdoc/config.schema.json"
446
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/cli/index.d.ts
2
+ /** `yaakdoc ./api.json --port 3000` → `yaakdoc dev ./api.json --port 3000` */
3
+ export declare function normalizeArgs(argv: string[]): string[];
4
+ export declare function run(argv?: string[]): Promise<void>;
5
+ //#endregion