@gitpagedocs/cli 1.1.61 → 1.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +193 -191
  2. package/ai/application/ai-command.ts +24 -24
  3. package/ai/application/ai-provider-factory.ts +22 -22
  4. package/ai/application/docs-pattern.ts +68 -68
  5. package/ai/application/run-ai-cli-command.ts +167 -167
  6. package/ai/config.ts +50 -50
  7. package/ai/core/models/ai-cli-config.ts +33 -33
  8. package/ai/core/models/parse-ai-cli-config.ts +78 -78
  9. package/ai/core/ports/illm-provider.ts +32 -32
  10. package/ai/infrastructure/ai-config-file.ts +101 -101
  11. package/ai/infrastructure/file-system-adapter.ts +85 -85
  12. package/ai/infrastructure/llm/tools-llm-provider.ts +54 -54
  13. package/ai/infrastructure/version-docs-writer.ts +143 -143
  14. package/ai/presentation/ai-prompts.ts +239 -239
  15. package/application/config-only/handler.mjs +2 -0
  16. package/application/home/handler.mjs +2 -0
  17. package/application/ports/cli-runtime-ports.ts +91 -87
  18. package/application/report/config-only-reporter.mjs +64 -63
  19. package/application/use-cases/dispatch-mode.ts +18 -18
  20. package/builders/config-orchestrator.mjs +34 -34
  21. package/builders/project-links.mjs +50 -26
  22. package/builders/root-config-builder.d.mts +16 -0
  23. package/builders/root-config-builder.mjs +61 -53
  24. package/builders/route-builders.mjs +136 -136
  25. package/builders/theme-template.mjs +76 -76
  26. package/builders/version-config-builder.mjs +186 -186
  27. package/content/docs-en.mjs +549 -545
  28. package/content/docs-es.mjs +462 -460
  29. package/content/docs-pt.mjs +462 -460
  30. package/contracts/doc-versions.mjs +3 -3
  31. package/contracts/index.mjs +10 -0
  32. package/contracts/layouts-paths.d.mts +17 -0
  33. package/contracts/layouts-paths.mjs +68 -0
  34. package/data/default-site-config.mjs +321 -321
  35. package/data/i18n-langmenu.mjs +347 -347
  36. package/data/layouts.mjs +436 -436
  37. package/data/path-mappings.mjs +26 -26
  38. package/data/route-metas.mjs +93 -93
  39. package/data/theme-colors.mjs +443 -443
  40. package/data/urls.mjs +12 -12
  41. package/domain/models/cli-options.ts +33 -18
  42. package/domain/services/layouts-migration.d.mts +15 -0
  43. package/domain/services/layouts-migration.mjs +60 -0
  44. package/home/constants.mjs +4 -4
  45. package/index.mjs +37 -37
  46. package/infrastructure/gitpagedocs-config-file.ts +47 -47
  47. package/infrastructure/home/runtime.mjs +37 -37
  48. package/package.json +3 -3
  49. package/presentation/commands/ai-info.ts +57 -57
  50. package/presentation/commands/config-clear.ts +23 -23
  51. package/presentation/commands/config-info.ts +24 -24
  52. package/presentation/commands/diagnostics.ts +164 -164
  53. package/presentation/commands/docs.ts +37 -37
  54. package/presentation/commands/mcp.ts +20 -20
  55. package/presentation/commands/pages.ts +101 -101
  56. package/presentation/commands/password.ts +62 -62
  57. package/presentation/commands/run-command.ts +70 -70
  58. package/presentation/index.ts +124 -116
  59. package/presentation/options/parser.ts +119 -104
  60. package/presentation/options/resolver.ts +46 -48
  61. package/presentation/options/schema.ts +4 -0
  62. package/presentation/ui/clack.ts +91 -91
  63. package/presentation/ui/layouts-prompts.ts +124 -0
  64. package/presentation/ui/prompts.ts +146 -138
  65. package/presentation/ui/tty.ts +37 -0
  66. package/runtime/git-ops.mjs +110 -110
  67. package/runtime/layouts-migrator.d.mts +11 -0
  68. package/runtime/layouts-migrator.mjs +103 -0
  69. package/runtime/output.mjs +159 -146
  70. package/runtime/workflow.mjs +129 -129
  71. package/start.mjs +12 -12
  72. package/ui/logger.mjs +9 -9
@@ -1,545 +1,549 @@
1
- import { PACKAGE_VERSION } from "../contracts/doc-versions.mjs";
2
-
3
- export const docsEn = {
4
- index: `# Git Page Docs
5
-
6
- Git Page Docs is a multilingual documentation runtime for repositories that ship a \`gitpagedocs/\` folder.
7
-
8
- ## What this project delivers
9
-
10
- - Multilingual markdown rendering (\`en\`, \`pt\`, \`es\`)
11
- - Version-aware docs routing (\`/v/:version\`)
12
- - Theme system with JSON templates
13
- - Local and GitHub Pages execution modes
14
- - Optional repository search + remote rendering
15
-
16
- ## Folder contract
17
-
18
- The runtime expects this structure:
19
-
20
- - \`gitpagedocs/config.json\`
21
- - \`gitpagedocs/docs/<lang>/*.md\`
22
- - \`gitpagedocs/docs/versions/<version>/config.json\`
23
- - \`gitpagedocs/docs/versions/<version>/<lang>/*.md\`
24
- - \`gitpagedocs/layouts/layoutsConfig.json\`
25
- - \`gitpagedocs/layouts/templates/*.json\`
26
-
27
- ## Quick navigation
28
-
29
- - Open **Getting Started** for local setup.
30
- - Open **Configuration** for full \`config.json\` explanation.
31
- - Open **Deployment** for local, server, and GitHub Pages behavior.
32
- - Open **Architecture** for code map and data flow.
33
- - Open **Themes and layouts** for template authoring details.
34
- - Open **Authorized routes** for key, roles, and external auth setup.
35
- - Open **FAQ** for troubleshooting.
36
- `,
37
- gettingStarted: `# Getting Started
38
-
39
- This guide configures your repository from zero to running docs.
40
-
41
- ## Prerequisites
42
-
43
- - Node.js 20+
44
- - npm 10+
45
-
46
- ## Install and generate
47
-
48
- 1. Install package:
49
- - \`npm install @gitpagedocs/cli\`
50
- 2. Generate docs config and versions:
51
- - \`npx @gitpagedocs/cli\`
52
- 3. Optional: generate local layouts/templates:
53
- - \`npx @gitpagedocs/cli --layoutconfig\`
54
-
55
- ## Local run
56
-
57
- 1. Development:
58
- - \`npm run dev\`
59
- 2. Production locally:
60
- - \`npm run build\`
61
- - \`npm start\`
62
-
63
- ## CLI behavior
64
-
65
- \`npx @gitpagedocs/cli\` generates only artifacts in \`gitpagedocs/\`:
66
-
67
- - JSON + markdown docs assets
68
- - No \`index.html\`
69
- - No \`index.js\`
70
- - No install command execution
71
-
72
- ## Repository search mode
73
-
74
- Local repository search is controlled by:
75
-
76
- - \`GITPAGEDOCS_REPOSITORY_SEARCH=true\`
77
- - \`GITPAGEDOCS_REPOSITORY_SEARCH=false\`
78
-
79
- On GitHub Pages builds (\`GITHUB_ACTIONS=true\`), repository-search home is enabled.
80
- `,
81
- projectOverview: `# Project Overview
82
-
83
- Git Page Docs is a **pnpm + turborepo monorepo** that turns a repository's \`gitpagedocs/\` folder into a multilingual, versioned documentation site — with an integrated AI assistant and a Model Context Protocol (MCP) server.
84
-
85
- ## Monorepo packages
86
-
87
- - **frontend/** — Next.js 15 (App Router, React 19) documentation viewer, static-exported for GitHub Pages.
88
- - **cli/** — the published \`@gitpagedocs/cli\` npm package (\`npm install -g @gitpagedocs/cli\`): scaffolds the docs contract, generates docs with AI, configures Pages, and runs the MCP server.
89
- - **tools/** — \`@gitpagedocs/tools\`, the shared business-logic core: the 14-provider AI system, the encrypted credential vault, the config loader, caches, and the logger.
90
- - **mcp/** — \`@gitpagedocs/mcp\`, a Model Context Protocol server (20 tools + 7 resources).
91
- - **gitpagedocs/** — the user contract: \`config.json\`, versioned docs, and layouts.
92
-
93
- ## Stack
94
-
95
- - Next.js 15 (App Router) + React 19 + TypeScript; static export for GitHub Pages
96
- - gray-matter + marked for Markdown; react-icons
97
- - pnpm workspaces + turborepo; Vitest + Playwright; ESLint
98
-
99
- ## Highlights
100
-
101
- - Multilingual (\`en\`, \`pt\`, \`es\`) and version-aware routing (\`/v/:version\`)
102
- - 14-provider AI system (OpenAI, Anthropic, Gemini, Ollama, Mistral, DeepSeek, Cohere, Groq, xAI, and more) with streaming
103
- - AI API keys stored **encrypted at rest** (AES-256-GCM) behind a local password gate — never plaintext
104
- - In-docs **AI chat drawer** plus a dedicated **\`/ai\` console**
105
- - 36-theme layout system; local and GitHub Pages execution modes
106
- `,
107
- functionalities: `# Functionalities
108
-
109
- Complete reference of CLI options, configuration keys, and runtime features.
110
-
111
- ## CLI commands
112
-
113
- | Command | Description |
114
- |---------|--------------|
115
- | \`gitpagedocs\` | Generate config and docs in \`gitpagedocs/\` |
116
- | \`gitpagedocs --layoutconfig\` | Also generate local layouts/templates |
117
- | \`gitpagedocs --home\` | Standalone distribution (\`gitpagedocshome/\`) |
118
- | \`gitpagedocs --push --owner X --repo Y\` | Setup workflow, commit, push |
119
- | \`gitpagedocs --interactive\` / \`-i\` | Interactive mode with prompts |
120
- | \`gitpagedocs ai\` | Interactive AI documentation generator |
121
- | \`gitpagedocs provider [id]\` / \`models [provider]\` | List AI providers / catalog models |
122
- | \`gitpagedocs document[:repo\\|:file\\|:folder]\` | Generate documentation with AI |
123
- | \`gitpagedocs deploy\` / \`pages [actions\\|deploy]\` | Configure GitHub Pages via Actions + push |
124
- | \`gitpagedocs docs\` | Refresh README/CONTRIBUTING/SECURITY managed regions |
125
- | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / registry update check |
126
- | \`gitpagedocs mcp start\` | Start the MCP server over stdio |
127
-
128
- Install globally with \`npm install -g @gitpagedocs/cli\`, or run one-off with \`npx @gitpagedocs/cli\`.
129
-
130
- ## CLI options
131
-
132
- | Option | Description |
133
- |--------|-------------|
134
- | \`--owner <user>\` | GitHub owner |
135
- | \`--repo <repo>\` | GitHub repository |
136
- | \`--path <subpath>\` | Docs subpath (e.g. \`docs\`); without it, base path = repo name for correct CSS/JS on project sites |
137
- | \`--output <dir>\` | Output directory (default: \`gitpagedocs\`) |
138
- | \`--search true|false\` | Enable/disable repository search (\`--home\`) |
139
- | \`--layoutconfig\` | Generate \`gitpagedocs/layouts/\` |
140
- | \`--push\` | Create workflow, commit artifacts, push |
141
- | \`--home\` | Generate \`gitpagedocshome/\` (static + .env + Dockerfile) |
142
-
143
- ## Generated output
144
-
145
- - \`gitpagedocs/config.json\` – root config
146
- - \`gitpagedocs/icon.svg\` – default icon
147
- - \`gitpagedocs/docs/versions/<ver>/config.json\` – per-version routes
148
- - \`gitpagedocs/docs/versions/<ver>/{en,pt,es}/*.md\` – markdown docs
149
- - \`gitpagedocs/layouts/\` – only with \`--layoutconfig\`
150
-
151
- ## Content types
152
-
153
- | Type | Config key | Description |
154
- |------|------------|-------------|
155
- | Markdown | \`routes-md\` | .md files with \`path\` per language |
156
- | HTML | \`routes-html\` | local \`path\` or external \`url\` |
157
- | Video | \`routes-video\` | \`video.pathVideo\`, \`video.videoType\` |
158
- | Audio | \`routes-audio\` | \`audio.pathAudio\`, \`audio.audioType\` |
159
-
160
- ## Source code viewer
161
-
162
- The version config can render a **Source code** container through \`routes-source-viewer\` and \`menus-header-source-viewer\`. The viewer reads GitHub repository trees at runtime and applies the current documentation theme.
163
-
164
- - Repository tree from \`source-viewer-path\`; branch defaults to \`main\`
165
- - Folder navigation and file filtering
166
- - GitHub-style directory listing
167
- - Code rendering with line numbers
168
- - Markdown preview/code toggle, including \`README.md\`
169
- - Collapsible folders in the sidebar
170
-
171
- ## Config keys (site)
172
-
173
- - \`name\`, \`defaultLanguage\`, \`supportedLanguages\`
174
- - \`docsVersion\`, \`rendering\`, \`ThemeDefault\`, \`ThemeModeDefault\`
175
- - \`ProjectLink\`, \`layoutsConfigPathOficial\`, \`layoutsConfigPath\`
176
-
177
- ## Environment variables
178
-
179
- - \`GITPAGEDOCS_REPOSITORY_SEARCH\` – repository search (local)
180
- - \`GITHUB_ACTIONS\` – GitHub Pages build mode
181
-
182
- ## AI assistant
183
-
184
- The docs ship an AI assistant in two surfaces: an in-docs **chat drawer** (the AI chat button in the sidebar, enabled via \`site.AiChatEnabled\`) and a dedicated **\`/ai\` console** page.
185
-
186
- - **14 providers** via one shared core: OpenAI, Anthropic, Gemini, OpenRouter, Ollama, Azure OpenAI, Mistral, DeepSeek, Cohere, Groq, xAI, Together, Fireworks, Perplexity.
187
- - **Model selection** — pick from each provider's catalog (\`gitpagedocs models <provider>\`) or type a custom id.
188
- - **Encrypted at rest** — your API key is sealed with AES-256-GCM behind a **local password** (one unlock per session) and is never stored in plaintext or logged. A legacy plaintext key is migrated and wiped on first unlock.
189
- - **AI documentation generation** — \`gitpagedocs ai\` scans chosen paths and writes multilingual markdown (pt/en/es); reusable via \`.gitpagedocsconfig\`.
190
-
191
- ## MCP server
192
-
193
- \`gitpagedocs mcp start\` runs a Model Context Protocol server (stdio) exposing **20 tools** (filesystem, AI, doc generation/analysis) and **7 resources** (\`project://structure|docs|config|repository|readme|ai/providers|ai/models\`) for editors and AI agents.
194
- `,
195
- githubIssuesProjects: `# GitHub Issues and Projects
196
-
197
- Learn how to use GitHub Issues and Projects to manage your work.
198
-
199
- ## Issues
200
-
201
- - Track bugs, features, and tasks
202
- - Assignees, labels, milestones
203
- - Discussions and linked PRs
204
-
205
- ## Projects
206
-
207
- - Kanban boards
208
- - Tables and roadmaps
209
- - Custom fields and automation
210
- `,
211
- gitIntroduction: `# Introduction to Git
212
-
213
- Basic Git concepts for beginners.
214
-
215
- ## Key concepts
216
-
217
- - **Repository**: A project folder tracked by Git
218
- - **Commit**: A snapshot of changes
219
- - **Branch**: Alternative line of development
220
- - **Remote**: Shared repository (e.g. on GitHub)
221
-
222
- ## Common commands
223
-
224
- - \`git init\` - Initialize a repo
225
- - \`git add\` - Stage changes
226
- - \`git commit\` - Create a snapshot
227
- - \`git push\` - Send to remote
228
- `,
229
- authorizedRoutes: `# Authorized Routes
230
-
231
- Protect routes by access key, required roles, and external authentication providers.
232
-
233
- ## Version config location
234
-
235
- Configure this at:
236
-
237
- - \`gitpagedocs/docs/versions/<version>/config.json\`
238
-
239
- ## Global auth section
240
-
241
- Use top-level \`auth\` in version config:
242
-
243
- - \`accessKeys\`: map of key ids to expected secrets
244
- - \`rolesStorageKey\`: localStorage key for role bootstrap
245
- - \`providers\`: external providers list (\`authjs\`, \`clerk\`, \`firebase\`, \`jwt\`)
246
-
247
- ## Route-level authorization
248
-
249
- Inside each route (\`routes-md\`, \`routes-html\`, \`routes-video\`):
250
-
251
- - \`authorization.accessKeyId\`
252
- - \`authorization.requiredRoles\`
253
- - \`authorization.requireExternalAuth\`
254
- - \`authorization.allowedProviders\`
255
-
256
- ## Phases
257
-
258
- ### Phase A - Access key
259
-
260
- Set \`authorization.accessKeyId\` and define that key in \`auth.accessKeys\`.
261
-
262
- ### Phase B - Roles
263
-
264
- Set \`authorization.requiredRoles\` with one or more roles.
265
-
266
- Roles can come from:
267
-
268
- - query param \`?authRoles=admin,maintainer\`
269
- - localStorage (\`rolesStorageKey\`)
270
- - external provider claims
271
-
272
- ### Phase C - External providers
273
-
274
- Set \`authorization.requireExternalAuth=true\` and optionally \`allowedProviders\`.
275
-
276
- Supported adapters:
277
-
278
- - Auth.js (\`type: "authjs"\`)
279
- - Clerk (\`type: "clerk"\`)
280
- - Firebase Auth (\`type: "firebase"\`)
281
- - Custom JWT (\`type: "jwt"\`)
282
-
283
- ## Example
284
-
285
- \`\`\`json
286
- {
287
- "auth": {
288
- "accessKeys": {
289
- "docs-key": "open-gitpagedocs-docs"
290
- },
291
- "providers": [
292
- { "type": "authjs", "enabled": true, "sessionEndpoint": "/api/auth/session" },
293
- { "type": "jwt", "enabled": true, "tokenStorageKey": "git-page-docs:jwt-token" }
294
- ]
295
- },
296
- "routes-md": [
297
- {
298
- "id": 6,
299
- "path": {
300
- "en": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/en/authorized-routes.md",
301
- "pt": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/pt/authorized-routes.md",
302
- "es": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/es/authorized-routes.md"
303
- },
304
- "authorization": {
305
- "accessKeyId": "docs-key",
306
- "requiredRoles": ["maintainer"],
307
- "requireExternalAuth": true,
308
- "allowedProviders": ["authjs", "jwt"]
309
- }
310
- }
311
- ]
312
- }
313
- \`\`\`
314
- `,
315
- configuration: `# Configuration
316
-
317
- Runtime configuration lives in \`gitpagedocs/config.json\`.
318
-
319
- ## \`site\` section
320
-
321
- Important keys:
322
-
323
- - \`name\`
324
- - \`defaultLanguage\`
325
- - \`supportedLanguages\`
326
- - \`docsVersion\`
327
- - \`rendering\`
328
- - \`ThemeDefault\`
329
- - \`ThemeModeDefault\`
330
- - \`ProjectLink\`
331
-
332
- ## Layout source keys
333
-
334
- - \`layoutsConfigPathOficial\`
335
- - \`layoutsConfigPathOficialUrl\`
336
- - \`layoutsConfigPathTemplatesOficial\`
337
- - \`layoutsConfigPath\`
338
- - \`layoutsConfigPathTemplates\`
339
-
340
- Behavior:
341
-
342
- - If \`layoutsConfigPathOficial=true\`, runtime prefers official layout/template sources.
343
- - If \`layoutsConfigPathOficial=false\`, runtime prefers repository-local/custom layout sources.
344
-
345
- ## \`VersionControl\` section
346
-
347
- \`VersionControl.versions\` defines:
348
-
349
- - \`id\`
350
- - \`path\`
351
- - optional metadata links (\`ProjectLink\`, \`branch\`, \`release\`, \`commit\`)
352
- - optional source viewer metadata (\`source-viewer\`, \`source-viewer-path\`)
353
-
354
- ## Navigation
355
-
356
- - \`routes\`: markdown paths per language (legacy)
357
- - \`menus-header\`: hierarchical menu model
358
- - \`translations\`: UI labels
359
-
360
- ## Authorization (version config)
361
-
362
- - \`auth\`: global authorization runtime settings for that version
363
- - \`auth.accessKeys\`: key map used by \`authorization.accessKeyId\`
364
- - \`auth.rolesStorageKey\`: localStorage key for role bootstrap
365
- - \`auth.providers\`: provider adapters (\`authjs\`, \`clerk\`, \`firebase\`, \`jwt\`)
366
-
367
- ## Content types (version config)
368
-
369
- Version configs support multiple content types:
370
-
371
- - \`routes-md\`: Markdown routes with optional \`title\`, \`description\` (centered via \`titlePosition\`, \`descriptionPosition\`)
372
- - \`routes-source-viewer\`: Source viewer containers with \`source-viewer: true\` and \`source-viewer-path\`
373
- - \`routes-html\`: HTML page paths per language
374
- - \`routes-video\`: Video config with \`video.videoType\` (youtube, vimeo, mp4, etc.) and \`video.pathVideo\`
375
- - \`routes-audio\`: Audio config with \`audio.audioType\` (youtube, mp3, etc.) and \`audio.pathAudio\`
376
- - \`authorization\` (md/html/video): route guard by access key, roles, and external auth
377
- - \`menus-header-md\`, \`menus-header-source-viewer\`, \`menus-header-html\`, \`menus-header-video\`, \`menus-header-audio\`: menus per type
378
- - \`hierarchyPage\`: container order on page \`{ md: 0, "source-viewer": 1, html: 2, video: 3, audio: 4 }\`
379
- - \`hierarchyMenu\`: menu section order \`{ md: 0, "source-viewer": 1, html: 2, video: 3, audio: 4 }\`
380
-
381
- Each route can include \`title\`, \`description\` (per language), \`titleCss\`, \`titlePosition: "center"\`, \`descriptionPosition: "center"\`, \`titleIsVisible\`, \`descriptionIsVisible\`.
382
-
383
- ## Route-level variables (blockLink, container, url, browseAll)
384
-
385
- Per-route options for \`routes-md\`, \`routes-html\`, \`routes-video\`, and \`routes-audio\`:
386
-
387
- - **\`blockLink\`** (default: true) – For HTML: if true, links open in a new tab (\`target="_blank"\`); if false, links open in the same context.
388
- - **\`container\`** – \`"full"\` = auto-extend height; number (e.g. \`500\`) = fixed height in px with overflow auto. Applies to md, html, video, and audio containers.
389
- - **\`url\`** – For \`routes-html\` only: \`Record<LanguageCode, string>\` with external URLs. When set, the iframe uses \`src={url}\` instead of local HTML via \`srcDoc\`. Routes with \`url\` do not generate local HTML files.
390
- - **\`browseAll\`** (default: false) – If true, the container shows Previous/Next buttons to browse all items of that type without changing the page.
391
-
392
- ## Content types: path vs url (HTML)
393
-
394
- - **Markdown (\`routes-md\`)**: always uses \`path\` pointing to local \`.md\` files.
395
- - **HTML (\`routes-html\`)**: uses \`path\` for local HTML files (no \`.html\` extension in config) or \`url\` for external URLs. When \`url\` is set, the iframe loads the external page; no local file is generated.
396
- - **Video (\`routes-video\`)**: uses \`video.pathVideo\` and \`video.videoType\` (youtube, vimeo, mp4, etc.).
397
- - **Audio (\`routes-audio\`)**: uses \`audio.pathAudio\` and \`audio.audioType\` (youtube, mp3, etc.). No autoplay by default.
398
-
399
- ## Environment variables
400
-
401
- - \`GITPAGEDOCS_REPOSITORY_SEARCH\`: enable/disable remote repository search in local runtime
402
- - \`GITHUB_ACTIONS\`: enables GitHub Pages specific runtime behavior
403
- `,
404
- deployment: `# Deployment
405
-
406
- Git Page Docs supports two usage models:
407
-
408
- 1. Use the official viewer site
409
- 2. Self-host your own GitHub Pages runtime
410
-
411
- ## Official viewer site
412
-
413
- Use:
414
-
415
- - \`https://vidigal-code.github.io/git-page-docs/\`
416
-
417
- Provide owner + repository to load docs from repositories that contain \`gitpagedocs/\`.
418
-
419
- ## Self-hosted GitHub Pages
420
-
421
- 1. Generate docs:
422
- - \`npx @gitpagedocs/cli\`
423
- - or \`npx @gitpagedocs/cli --layoutconfig\` for local templates
424
- 2. Set \`site.rendering\` in \`gitpagedocs/config.json\`:
425
- - \`https://<your-user>.github.io/<your-repo>/\`
426
- 3. Build and validate:
427
- - \`npm run lint\`
428
- - \`npm run build\`
429
- 4. Deploy with GitHub Pages workflow.
430
-
431
- When \`GITHUB_ACTIONS=true\`, runtime applies GitHub Pages behavior.
432
-
433
- ## npm publish flows
434
-
435
- Recommended: GitHub Release + CI publish.
436
-
437
- Manual fallback:
438
-
439
- 1. \`npm whoami\`
440
- 2. \`npm run lint\`
441
- 3. \`npm run build\`
442
- 4. \`npm pack --ignore-scripts\`
443
- 5. \`npm version patch\`
444
- 6. \`npm publish --access public\`
445
- `,
446
- architecture: `# Architecture
447
-
448
- A pnpm + turborepo monorepo where all business logic lives in one shared core (\`tools/\`); the frontend, CLI, and MCP server are thin consumers of it.
449
-
450
- ## Packages
451
-
452
- - **frontend/** — Next.js viewer (Feature-Sliced: \`app / widgets / features / entities / shared\`); static export.
453
- - **cli/** — the published \`gitpagedocs\` bin (hexagonal: \`presentation / application / domain / infrastructure\`) + \`cli/ai/\` (the AI documentation CLI).
454
- - **tools/** — \`@gitpagedocs/tools\`: \`ai/ security/ crypto/ cache/ config/ logger/ errors/ filesystem/ documentation/ ports/\`.
455
- - **mcp/** — \`@gitpagedocs/mcp\`: MCP tools + resources delegating to \`tools/\`.
456
-
457
- ## Main runtime modules (frontend)
458
-
459
- - \`frontend/src/app/[[...repo]]/page.tsx\` — route parser, static params, shell selection (docs vs repository-search).
460
- - \`frontend/src/entities/docs/api/load-docs-data.ts\` — local/remote config loading, version resolution, markdown parse, layouts + themes.
461
- - \`frontend/src/widgets/docs-shell/docs-shell.tsx\` — UI rendering, language/version/theme state, URL sync, AI chat drawer mount.
462
-
463
- ## Security: encrypted AI credentials
464
-
465
- The \`/ai\` console and the chat drawer gate access behind a local password that derives (PBKDF2) an AES-256-GCM key; keys live encrypted in \`localStorage\` and are decrypted only for the session (\`@gitpagedocs/tools/security\`).
466
-
467
- ## Data flow
468
-
469
- 1. Request route arrives (\`/owner/repo/v/x.y.z\` or local equivalent)
470
- 2. Config is resolved (local or remote repo)
471
- 3. Version config overrides base routes/menus
472
- 4. Markdown is loaded and converted to HTML
473
- 5. Layout template is resolved and CSS vars applied
474
- 6. Shell renders content + controls
475
-
476
- ## Reliability points
477
-
478
- - fallback strategy for layout/template loading
479
- - resilient markdown loading per language
480
- - localStorage sync for user language/version/theme
481
- `,
482
- themes: `# Themes and Layouts
483
-
484
- Themes are JSON templates mapped by \`layoutsConfig.json\`.
485
-
486
- ## Strategy options
487
-
488
- - Default mode (\`npx @gitpagedocs/cli\`): use official layouts/templates from the upstream repository.
489
- - Local mode (\`npx @gitpagedocs/cli --layoutconfig\`): generate and use local templates from your repository.
490
-
491
- ## Local layout files
492
-
493
- - \`gitpagedocs/layouts/layoutsConfig.json\`
494
- - \`gitpagedocs/layouts/layoutsFallbackConfig.json\`
495
- - \`gitpagedocs/layouts/templates/*.json\`
496
-
497
- ## Template model
498
-
499
- Each template usually includes:
500
-
501
- - \`id\`, \`name\`, \`author\`, \`version\`
502
- - \`mode\` + dark/light pairing metadata
503
- - \`colors\`
504
- - \`typography\`
505
- - \`components\`
506
- - \`animations\`
507
-
508
- ## Runtime behavior
509
-
510
- - Active theme is resolved from config/user selection.
511
- - Light/dark toggle resolves paired theme via reference.
512
- - CSS variables are generated from template tokens.
513
- - Runtime includes fallback behavior if a source is unavailable.
514
- `,
515
- faq: `# FAQ
516
-
517
- ## Why are remote repositories not opening locally?
518
-
519
- Check:
520
-
521
- - \`GITPAGEDOCS_REPOSITORY_SEARCH=true\` in \`.env\`
522
- - target repo contains \`gitpagedocs/config.json\`
523
- - target repo markdown paths match its routes config
524
-
525
- ## Why does a version path return wrong content?
526
-
527
- Check:
528
-
529
- - \`VersionControl.versions[*].path\` in \`gitpagedocs/config.json\`
530
- - that version config has valid \`routes\` and \`menus-header\`
531
- - markdown files exist for each language
532
-
533
- ## Why does theme selection not apply correctly?
534
-
535
- Check:
536
-
537
- - \`layoutsConfig.json\` references valid template files
538
- - template ids are unique
539
- - selected theme exists in loaded themes map
540
-
541
- ## Why can GitHub Pages behave differently from local?
542
-
543
- Because GitHub Pages build mode enables repository-search home and static-export specific behavior.
544
- `,
545
- };
1
+ import { PACKAGE_VERSION } from "../contracts/doc-versions.mjs";
2
+
3
+ export const docsEn = {
4
+ index: `# Git Page Docs
5
+
6
+ Git Page Docs is a multilingual documentation runtime for repositories that ship a \`gitpagedocs/\` folder.
7
+
8
+ ## What this project delivers
9
+
10
+ - Multilingual markdown rendering (\`en\`, \`pt\`, \`es\`)
11
+ - Version-aware docs routing (\`/v/:version\`)
12
+ - Theme system with JSON templates
13
+ - Local and GitHub Pages execution modes
14
+ - Optional repository search + remote rendering
15
+
16
+ ## Folder contract
17
+
18
+ The runtime expects this structure:
19
+
20
+ - \`gitpagedocs/config.json\`
21
+ - \`gitpagedocs/docs/<lang>/*.md\`
22
+ - \`gitpagedocs/docs/versions/<version>/config.json\`
23
+ - \`gitpagedocs/docs/versions/<version>/<lang>/*.md\`
24
+ - \`gitpagelayouts/layoutsConfig.json\` (only with \`--layoutconfig\`)
25
+ - \`gitpagelayouts/templates/*.json\` (only with \`--layoutconfig\`)
26
+
27
+ ## Quick navigation
28
+
29
+ - Open **Getting Started** for local setup.
30
+ - Open **Configuration** for full \`config.json\` explanation.
31
+ - Open **Deployment** for local, server, and GitHub Pages behavior.
32
+ - Open **Architecture** for code map and data flow.
33
+ - Open **Themes and layouts** for template authoring details.
34
+ - Open **Authorized routes** for key, roles, and external auth setup.
35
+ - Open **FAQ** for troubleshooting.
36
+ `,
37
+ gettingStarted: `# Getting Started
38
+
39
+ This guide configures your repository from zero to running docs.
40
+
41
+ ## Prerequisites
42
+
43
+ - Node.js 20+
44
+ - npm 10+
45
+
46
+ ## Install and generate
47
+
48
+ 1. Install package:
49
+ - \`npm install @gitpagedocs/cli\`
50
+ 2. Generate docs config and versions:
51
+ - \`npx @gitpagedocs/cli\`
52
+ 3. Optional: generate local layouts/templates:
53
+ - \`npx @gitpagedocs/cli --layoutconfig\`
54
+
55
+ ## Local run
56
+
57
+ 1. Development:
58
+ - \`npm run dev\`
59
+ 2. Production locally:
60
+ - \`npm run build\`
61
+ - \`npm start\`
62
+
63
+ ## CLI behavior
64
+
65
+ \`npx @gitpagedocs/cli\` generates only artifacts in \`gitpagedocs/\`:
66
+
67
+ - JSON + markdown docs assets
68
+ - No \`index.html\`
69
+ - No \`index.js\`
70
+ - No install command execution
71
+
72
+ ## Repository search mode
73
+
74
+ Local repository search is controlled by:
75
+
76
+ - \`GITPAGEDOCS_REPOSITORY_SEARCH=true\`
77
+ - \`GITPAGEDOCS_REPOSITORY_SEARCH=false\`
78
+
79
+ On GitHub Pages builds (\`GITHUB_ACTIONS=true\`), repository-search home is enabled.
80
+ `,
81
+ projectOverview: `# Project Overview
82
+
83
+ Git Page Docs is a **pnpm + turborepo monorepo** that turns a repository's \`gitpagedocs/\` folder into a multilingual, versioned documentation site — with an integrated AI assistant and a Model Context Protocol (MCP) server.
84
+
85
+ ## Monorepo packages
86
+
87
+ - **frontend/** — Next.js 15 (App Router, React 19) documentation viewer, static-exported for GitHub Pages.
88
+ - **cli/** — the published \`@gitpagedocs/cli\` npm package (\`npm install -g @gitpagedocs/cli\`): scaffolds the docs contract, generates docs with AI, configures Pages, and runs the MCP server.
89
+ - **tools/** — \`@gitpagedocs/tools\`, the shared business-logic core: the 14-provider AI system, the encrypted credential vault, the config loader, caches, and the logger.
90
+ - **mcp/** — \`@gitpagedocs/mcp\`, a Model Context Protocol server (20 tools + 7 resources).
91
+ - **gitpagedocs/** — the user contract: \`config.json\`, versioned docs, and layouts.
92
+
93
+ ## Stack
94
+
95
+ - Next.js 15 (App Router) + React 19 + TypeScript; static export for GitHub Pages
96
+ - gray-matter + marked for Markdown; react-icons
97
+ - pnpm workspaces + turborepo; Vitest + Playwright; ESLint
98
+
99
+ ## Highlights
100
+
101
+ - Multilingual (\`en\`, \`pt\`, \`es\`) and version-aware routing (\`/v/:version\`)
102
+ - 14-provider AI system (OpenAI, Anthropic, Gemini, Ollama, Mistral, DeepSeek, Cohere, Groq, xAI, and more) with streaming
103
+ - AI API keys stored **encrypted at rest** (AES-256-GCM) behind a local password gate — never plaintext
104
+ - In-docs **AI chat drawer** plus a dedicated **\`/ai\` console**
105
+ - 36-theme layout system; local and GitHub Pages execution modes
106
+ `,
107
+ functionalities: `# Functionalities
108
+
109
+ Complete reference of CLI options, configuration keys, and runtime features.
110
+
111
+ ## CLI commands
112
+
113
+ | Command | Description |
114
+ |---------|--------------|
115
+ | \`gitpagedocs\` | Generate config and docs in \`gitpagedocs/\` |
116
+ | \`gitpagedocs --layoutconfig\` | Also generate local layouts/templates in \`gitpagelayouts/\` |
117
+ | \`gitpagedocs --home\` | Standalone distribution (\`gitpagedocshome/\`) |
118
+ | \`gitpagedocs --push --owner X --repo Y\` | Setup workflow, commit, push |
119
+ | \`gitpagedocs --interactive\` / \`-i\` | Interactive mode with prompts (the default in a terminal) |
120
+ | \`gitpagedocs --no-interactive\` / \`--yes\` / \`-y\` | Never prompt; use flags and defaults |
121
+ | \`gitpagedocs ai\` | Interactive AI documentation generator |
122
+ | \`gitpagedocs provider [id]\` / \`models [provider]\` | List AI providers / catalog models |
123
+ | \`gitpagedocs document[:repo\\|:file\\|:folder]\` | Generate documentation with AI |
124
+ | \`gitpagedocs deploy\` / \`pages [actions\\|deploy]\` | Configure GitHub Pages via Actions + push |
125
+ | \`gitpagedocs docs\` | Refresh README/CONTRIBUTING/SECURITY managed regions |
126
+ | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / registry update check |
127
+ | \`gitpagedocs mcp start\` | Start the MCP server over stdio |
128
+
129
+ Install globally with \`npm install -g @gitpagedocs/cli\`, or run one-off with \`npx @gitpagedocs/cli\`.
130
+
131
+ ## CLI options
132
+
133
+ | Option | Description |
134
+ |--------|-------------|
135
+ | \`--owner <user>\` | GitHub owner |
136
+ | \`--repo <repo>\` | GitHub repository |
137
+ | \`--path <subpath>\` | Docs subpath (e.g. \`docs\`); without it, base path = repo name for correct CSS/JS on project sites |
138
+ | \`--output <dir>\` | Output directory (default: \`gitpagedocs\`) |
139
+ | \`--search true|false\` | Enable/disable repository search (\`--home\`) |
140
+ | \`--layoutconfig\` | Generate local layouts in \`gitpagelayouts/\` |
141
+ | \`--layouts-dir <dir>\` | Folder for local layouts (default: \`gitpagelayouts\`) |
142
+ | \`--push\` | Create workflow, commit artifacts, push |
143
+ | \`--home\` | Generate \`gitpagedocshome/\` (static + .env + Dockerfile) |
144
+
145
+ ## Generated output
146
+
147
+ - \`gitpagedocs/config.json\` – root config
148
+ - \`gitpagedocs/icon.svg\` – default icon
149
+ - \`gitpagedocs/docs/versions/<ver>/config.json\` – per-version routes
150
+ - \`gitpagedocs/docs/versions/<ver>/{en,pt,es}/*.md\` – markdown docs
151
+ - \`gitpagelayouts/\` – only with \`--layoutconfig\` (folder configurable with \`--layouts-dir\`)
152
+
153
+ ## Content types
154
+
155
+ | Type | Config key | Description |
156
+ |------|------------|-------------|
157
+ | Markdown | \`routes-md\` | .md files with \`path\` per language |
158
+ | HTML | \`routes-html\` | local \`path\` or external \`url\` |
159
+ | Video | \`routes-video\` | \`video.pathVideo\`, \`video.videoType\` |
160
+ | Audio | \`routes-audio\` | \`audio.pathAudio\`, \`audio.audioType\` |
161
+
162
+ ## Source code viewer
163
+
164
+ The version config can render a **Source code** container through \`routes-source-viewer\` and \`menus-header-source-viewer\`. The viewer reads GitHub repository trees at runtime and applies the current documentation theme.
165
+
166
+ - Repository tree from \`source-viewer-path\`; branch defaults to \`main\`
167
+ - Folder navigation and file filtering
168
+ - GitHub-style directory listing
169
+ - Code rendering with line numbers
170
+ - Markdown preview/code toggle, including \`README.md\`
171
+ - Collapsible folders in the sidebar
172
+
173
+ ## Config keys (site)
174
+
175
+ - \`name\`, \`defaultLanguage\`, \`supportedLanguages\`
176
+ - \`docsVersion\`, \`rendering\`, \`ThemeDefault\`, \`ThemeModeDefault\`
177
+ - \`ProjectLink\`, \`layoutsConfigPathOficial\`, \`layoutsConfigPath\`
178
+
179
+ ## Environment variables
180
+
181
+ - \`GITPAGEDOCS_REPOSITORY_SEARCH\` – repository search (local)
182
+ - \`GITHUB_ACTIONS\` – GitHub Pages build mode
183
+
184
+ ## AI assistant
185
+
186
+ The docs ship an AI assistant in two surfaces: an in-docs **chat drawer** (the AI chat button in the sidebar, enabled via \`site.AiChatEnabled\`) and a dedicated **\`/ai\` console** page.
187
+
188
+ - **14 providers** via one shared core: OpenAI, Anthropic, Gemini, OpenRouter, Ollama, Azure OpenAI, Mistral, DeepSeek, Cohere, Groq, xAI, Together, Fireworks, Perplexity.
189
+ - **Model selection** — pick from each provider's catalog (\`gitpagedocs models <provider>\`) or type a custom id.
190
+ - **Encrypted at rest** — your API key is sealed with AES-256-GCM behind a **local password** (one unlock per session) and is never stored in plaintext or logged. A legacy plaintext key is migrated and wiped on first unlock.
191
+ - **AI documentation generation** — \`gitpagedocs ai\` scans chosen paths and writes multilingual markdown (pt/en/es); reusable via \`.gitpagedocsconfig\`.
192
+
193
+ ## MCP server
194
+
195
+ \`gitpagedocs mcp start\` runs a Model Context Protocol server (stdio) exposing **20 tools** (filesystem, AI, doc generation/analysis) and **7 resources** (\`project://structure|docs|config|repository|readme|ai/providers|ai/models\`) for editors and AI agents.
196
+ `,
197
+ githubIssuesProjects: `# GitHub Issues and Projects
198
+
199
+ Learn how to use GitHub Issues and Projects to manage your work.
200
+
201
+ ## Issues
202
+
203
+ - Track bugs, features, and tasks
204
+ - Assignees, labels, milestones
205
+ - Discussions and linked PRs
206
+
207
+ ## Projects
208
+
209
+ - Kanban boards
210
+ - Tables and roadmaps
211
+ - Custom fields and automation
212
+ `,
213
+ gitIntroduction: `# Introduction to Git
214
+
215
+ Basic Git concepts for beginners.
216
+
217
+ ## Key concepts
218
+
219
+ - **Repository**: A project folder tracked by Git
220
+ - **Commit**: A snapshot of changes
221
+ - **Branch**: Alternative line of development
222
+ - **Remote**: Shared repository (e.g. on GitHub)
223
+
224
+ ## Common commands
225
+
226
+ - \`git init\` - Initialize a repo
227
+ - \`git add\` - Stage changes
228
+ - \`git commit\` - Create a snapshot
229
+ - \`git push\` - Send to remote
230
+ `,
231
+ authorizedRoutes: `# Authorized Routes
232
+
233
+ Protect routes by access key, required roles, and external authentication providers.
234
+
235
+ ## Version config location
236
+
237
+ Configure this at:
238
+
239
+ - \`gitpagedocs/docs/versions/<version>/config.json\`
240
+
241
+ ## Global auth section
242
+
243
+ Use top-level \`auth\` in version config:
244
+
245
+ - \`accessKeys\`: map of key ids to expected secrets
246
+ - \`rolesStorageKey\`: localStorage key for role bootstrap
247
+ - \`providers\`: external providers list (\`authjs\`, \`clerk\`, \`firebase\`, \`jwt\`)
248
+
249
+ ## Route-level authorization
250
+
251
+ Inside each route (\`routes-md\`, \`routes-html\`, \`routes-video\`):
252
+
253
+ - \`authorization.accessKeyId\`
254
+ - \`authorization.requiredRoles\`
255
+ - \`authorization.requireExternalAuth\`
256
+ - \`authorization.allowedProviders\`
257
+
258
+ ## Phases
259
+
260
+ ### Phase A - Access key
261
+
262
+ Set \`authorization.accessKeyId\` and define that key in \`auth.accessKeys\`.
263
+
264
+ ### Phase B - Roles
265
+
266
+ Set \`authorization.requiredRoles\` with one or more roles.
267
+
268
+ Roles can come from:
269
+
270
+ - query param \`?authRoles=admin,maintainer\`
271
+ - localStorage (\`rolesStorageKey\`)
272
+ - external provider claims
273
+
274
+ ### Phase C - External providers
275
+
276
+ Set \`authorization.requireExternalAuth=true\` and optionally \`allowedProviders\`.
277
+
278
+ Supported adapters:
279
+
280
+ - Auth.js (\`type: "authjs"\`)
281
+ - Clerk (\`type: "clerk"\`)
282
+ - Firebase Auth (\`type: "firebase"\`)
283
+ - Custom JWT (\`type: "jwt"\`)
284
+
285
+ ## Example
286
+
287
+ \`\`\`json
288
+ {
289
+ "auth": {
290
+ "accessKeys": {
291
+ "docs-key": "open-gitpagedocs-docs"
292
+ },
293
+ "providers": [
294
+ { "type": "authjs", "enabled": true, "sessionEndpoint": "/api/auth/session" },
295
+ { "type": "jwt", "enabled": true, "tokenStorageKey": "git-page-docs:jwt-token" }
296
+ ]
297
+ },
298
+ "routes-md": [
299
+ {
300
+ "id": 6,
301
+ "path": {
302
+ "en": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/en/authorized-routes.md",
303
+ "pt": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/pt/authorized-routes.md",
304
+ "es": "gitpagedocs/docs/versions/${PACKAGE_VERSION}/es/authorized-routes.md"
305
+ },
306
+ "authorization": {
307
+ "accessKeyId": "docs-key",
308
+ "requiredRoles": ["maintainer"],
309
+ "requireExternalAuth": true,
310
+ "allowedProviders": ["authjs", "jwt"]
311
+ }
312
+ }
313
+ ]
314
+ }
315
+ \`\`\`
316
+ `,
317
+ configuration: `# Configuration
318
+
319
+ Runtime configuration lives in \`gitpagedocs/config.json\`.
320
+
321
+ ## \`site\` section
322
+
323
+ Important keys:
324
+
325
+ - \`name\`
326
+ - \`defaultLanguage\`
327
+ - \`supportedLanguages\`
328
+ - \`docsVersion\`
329
+ - \`rendering\`
330
+ - \`ThemeDefault\`
331
+ - \`ThemeModeDefault\`
332
+ - \`ProjectLink\`
333
+
334
+ ## Layout source keys
335
+
336
+ - \`layoutsConfigPathOficial\`
337
+ - \`layoutsConfigPathOficialUrl\`
338
+ - \`layoutsConfigPathTemplatesOficial\`
339
+ - \`layoutsConfigPath\`
340
+ - \`layoutsConfigPathTemplates\`
341
+
342
+ Behavior:
343
+
344
+ - If \`layoutsConfigPathOficial=true\`, runtime prefers official layout/template sources.
345
+ - If \`layoutsConfigPathOficial=false\`, runtime prefers repository-local/custom layout sources.
346
+
347
+ ## \`VersionControl\` section
348
+
349
+ \`VersionControl.versions\` defines:
350
+
351
+ - \`id\`
352
+ - \`path\`
353
+ - optional metadata links (\`ProjectLink\`, \`branch\`, \`release\`, \`commit\`)
354
+ - optional source viewer metadata (\`source-viewer\`, \`source-viewer-path\`)
355
+
356
+ ## Navigation
357
+
358
+ - \`routes\`: markdown paths per language (legacy)
359
+ - \`menus-header\`: hierarchical menu model
360
+ - \`translations\`: UI labels
361
+
362
+ ## Authorization (version config)
363
+
364
+ - \`auth\`: global authorization runtime settings for that version
365
+ - \`auth.accessKeys\`: key map used by \`authorization.accessKeyId\`
366
+ - \`auth.rolesStorageKey\`: localStorage key for role bootstrap
367
+ - \`auth.providers\`: provider adapters (\`authjs\`, \`clerk\`, \`firebase\`, \`jwt\`)
368
+
369
+ ## Content types (version config)
370
+
371
+ Version configs support multiple content types:
372
+
373
+ - \`routes-md\`: Markdown routes with optional \`title\`, \`description\` (centered via \`titlePosition\`, \`descriptionPosition\`)
374
+ - \`routes-source-viewer\`: Source viewer containers with \`source-viewer: true\` and \`source-viewer-path\`
375
+ - \`routes-html\`: HTML page paths per language
376
+ - \`routes-video\`: Video config with \`video.videoType\` (youtube, vimeo, mp4, etc.) and \`video.pathVideo\`
377
+ - \`routes-audio\`: Audio config with \`audio.audioType\` (youtube, mp3, etc.) and \`audio.pathAudio\`
378
+ - \`authorization\` (md/html/video): route guard by access key, roles, and external auth
379
+ - \`menus-header-md\`, \`menus-header-source-viewer\`, \`menus-header-html\`, \`menus-header-video\`, \`menus-header-audio\`: menus per type
380
+ - \`hierarchyPage\`: container order on page \`{ md: 0, "source-viewer": 1, html: 2, video: 3, audio: 4 }\`
381
+ - \`hierarchyMenu\`: menu section order \`{ md: 0, "source-viewer": 1, html: 2, video: 3, audio: 4 }\`
382
+
383
+ Each route can include \`title\`, \`description\` (per language), \`titleCss\`, \`titlePosition: "center"\`, \`descriptionPosition: "center"\`, \`titleIsVisible\`, \`descriptionIsVisible\`.
384
+
385
+ ## Route-level variables (blockLink, container, url, browseAll)
386
+
387
+ Per-route options for \`routes-md\`, \`routes-html\`, \`routes-video\`, and \`routes-audio\`:
388
+
389
+ - **\`blockLink\`** (default: true) – For HTML: if true, links open in a new tab (\`target="_blank"\`); if false, links open in the same context.
390
+ - **\`container\`** – \`"full"\` = auto-extend height; number (e.g. \`500\`) = fixed height in px with overflow auto. Applies to md, html, video, and audio containers.
391
+ - **\`url\`** – For \`routes-html\` only: \`Record<LanguageCode, string>\` with external URLs. When set, the iframe uses \`src={url}\` instead of local HTML via \`srcDoc\`. Routes with \`url\` do not generate local HTML files.
392
+ - **\`browseAll\`** (default: false) – If true, the container shows Previous/Next buttons to browse all items of that type without changing the page.
393
+
394
+ ## Content types: path vs url (HTML)
395
+
396
+ - **Markdown (\`routes-md\`)**: always uses \`path\` pointing to local \`.md\` files.
397
+ - **HTML (\`routes-html\`)**: uses \`path\` for local HTML files (no \`.html\` extension in config) or \`url\` for external URLs. When \`url\` is set, the iframe loads the external page; no local file is generated.
398
+ - **Video (\`routes-video\`)**: uses \`video.pathVideo\` and \`video.videoType\` (youtube, vimeo, mp4, etc.).
399
+ - **Audio (\`routes-audio\`)**: uses \`audio.pathAudio\` and \`audio.audioType\` (youtube, mp3, etc.). No autoplay by default.
400
+
401
+ ## Environment variables
402
+
403
+ - \`GITPAGEDOCS_REPOSITORY_SEARCH\`: enable/disable remote repository search in local runtime
404
+ - \`GITHUB_ACTIONS\`: enables GitHub Pages specific runtime behavior
405
+ `,
406
+ deployment: `# Deployment
407
+
408
+ Git Page Docs supports two usage models:
409
+
410
+ 1. Use the official viewer site
411
+ 2. Self-host your own GitHub Pages runtime
412
+
413
+ ## Official viewer site
414
+
415
+ Use:
416
+
417
+ - \`https://vidigal-code.github.io/git-page-docs/\`
418
+
419
+ Provide owner + repository to load docs from repositories that contain \`gitpagedocs/\`.
420
+
421
+ ## Self-hosted GitHub Pages
422
+
423
+ 1. Generate docs:
424
+ - \`npx @gitpagedocs/cli\`
425
+ - or \`npx @gitpagedocs/cli --layoutconfig\` for local templates
426
+ 2. Set \`site.rendering\` in \`gitpagedocs/config.json\`:
427
+ - \`https://<your-user>.github.io/<your-repo>/\`
428
+ 3. Build and validate:
429
+ - \`npm run lint\`
430
+ - \`npm run build\`
431
+ 4. Deploy with GitHub Pages workflow.
432
+
433
+ When \`GITHUB_ACTIONS=true\`, runtime applies GitHub Pages behavior.
434
+
435
+ ## npm publish flows
436
+
437
+ Recommended: GitHub Release + CI publish.
438
+
439
+ Manual fallback:
440
+
441
+ 1. \`npm whoami\`
442
+ 2. \`npm run lint\`
443
+ 3. \`npm run build\`
444
+ 4. \`npm pack --ignore-scripts\`
445
+ 5. \`npm version patch\`
446
+ 6. \`npm publish --access public\`
447
+ `,
448
+ architecture: `# Architecture
449
+
450
+ A pnpm + turborepo monorepo where all business logic lives in one shared core (\`tools/\`); the frontend, CLI, and MCP server are thin consumers of it.
451
+
452
+ ## Packages
453
+
454
+ - **frontend/** — Next.js viewer (Feature-Sliced: \`app / widgets / features / entities / shared\`); static export.
455
+ - **cli/** — the published \`gitpagedocs\` bin (hexagonal: \`presentation / application / domain / infrastructure\`) + \`cli/ai/\` (the AI documentation CLI).
456
+ - **tools/** — \`@gitpagedocs/tools\`: \`ai/ security/ crypto/ cache/ config/ logger/ errors/ filesystem/ documentation/ ports/\`.
457
+ - **mcp/** — \`@gitpagedocs/mcp\`: MCP tools + resources delegating to \`tools/\`.
458
+
459
+ ## Main runtime modules (frontend)
460
+
461
+ - \`frontend/src/app/[[...repo]]/page.tsx\` — route parser, static params, shell selection (docs vs repository-search).
462
+ - \`frontend/src/entities/docs/api/load-docs-data.ts\` — local/remote config loading, version resolution, markdown parse, layouts + themes.
463
+ - \`frontend/src/widgets/docs-shell/docs-shell.tsx\` — UI rendering, language/version/theme state, URL sync, AI chat drawer mount.
464
+
465
+ ## Security: encrypted AI credentials
466
+
467
+ The \`/ai\` console and the chat drawer gate access behind a local password that derives (PBKDF2) an AES-256-GCM key; keys live encrypted in \`localStorage\` and are decrypted only for the session (\`@gitpagedocs/tools/security\`).
468
+
469
+ ## Data flow
470
+
471
+ 1. Request route arrives (\`/owner/repo/v/x.y.z\` or local equivalent)
472
+ 2. Config is resolved (local or remote repo)
473
+ 3. Version config overrides base routes/menus
474
+ 4. Markdown is loaded and converted to HTML
475
+ 5. Layout template is resolved and CSS vars applied
476
+ 6. Shell renders content + controls
477
+
478
+ ## Reliability points
479
+
480
+ - fallback strategy for layout/template loading
481
+ - resilient markdown loading per language
482
+ - localStorage sync for user language/version/theme
483
+ `,
484
+ themes: `# Themes and Layouts
485
+
486
+ Themes are JSON templates mapped by \`layoutsConfig.json\`.
487
+
488
+ ## Strategy options
489
+
490
+ - Default mode (\`npx @gitpagedocs/cli\`): use official layouts/templates from the upstream repository.
491
+ - Local mode (\`npx @gitpagedocs/cli --layoutconfig\`): generate and use local templates from your repository.
492
+
493
+ ## Local layout files
494
+
495
+ - \`gitpagelayouts/layoutsConfig.json\`
496
+ - \`gitpagelayouts/layoutsFallbackConfig.json\`
497
+ - \`gitpagelayouts/templates/*.json\`
498
+
499
+ The legacy \`gitpagedocs/layouts/\` location is no longer generated. It is still read by the viewer, and the CLI offers to move it into the layouts home - only after you confirm.
500
+
501
+ ## Template model
502
+
503
+ Each template usually includes:
504
+
505
+ - \`id\`, \`name\`, \`author\`, \`version\`
506
+ - \`mode\` + dark/light pairing metadata
507
+ - \`colors\`
508
+ - \`typography\`
509
+ - \`components\`
510
+ - \`animations\`
511
+
512
+ ## Runtime behavior
513
+
514
+ - Active theme is resolved from config/user selection.
515
+ - Light/dark toggle resolves paired theme via reference.
516
+ - CSS variables are generated from template tokens.
517
+ - Runtime includes fallback behavior if a source is unavailable.
518
+ `,
519
+ faq: `# FAQ
520
+
521
+ ## Why are remote repositories not opening locally?
522
+
523
+ Check:
524
+
525
+ - \`GITPAGEDOCS_REPOSITORY_SEARCH=true\` in \`.env\`
526
+ - target repo contains \`gitpagedocs/config.json\`
527
+ - target repo markdown paths match its routes config
528
+
529
+ ## Why does a version path return wrong content?
530
+
531
+ Check:
532
+
533
+ - \`VersionControl.versions[*].path\` in \`gitpagedocs/config.json\`
534
+ - that version config has valid \`routes\` and \`menus-header\`
535
+ - markdown files exist for each language
536
+
537
+ ## Why does theme selection not apply correctly?
538
+
539
+ Check:
540
+
541
+ - \`layoutsConfig.json\` references valid template files
542
+ - template ids are unique
543
+ - selected theme exists in loaded themes map
544
+
545
+ ## Why can GitHub Pages behave differently from local?
546
+
547
+ Because GitHub Pages build mode enables repository-search home and static-export specific behavior.
548
+ `,
549
+ };