@gitpagedocs/cli 1.1.62 → 1.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -193
- package/ai/application/ai-command.ts +24 -24
- package/ai/application/ai-provider-factory.ts +22 -22
- package/ai/application/docs-pattern.ts +68 -68
- package/ai/application/run-ai-cli-command.ts +167 -167
- package/ai/config.ts +50 -50
- package/ai/core/models/ai-cli-config.ts +33 -33
- package/ai/core/models/parse-ai-cli-config.ts +78 -78
- package/ai/core/ports/illm-provider.ts +32 -32
- package/ai/infrastructure/ai-config-file.ts +101 -101
- package/ai/infrastructure/file-system-adapter.ts +85 -85
- package/ai/infrastructure/llm/tools-llm-provider.ts +54 -54
- package/ai/infrastructure/version-docs-writer.ts +143 -143
- package/ai/presentation/ai-prompts.ts +239 -239
- package/application/ports/cli-runtime-ports.ts +91 -91
- package/application/report/config-only-reporter.mjs +64 -64
- package/application/use-cases/dispatch-mode.ts +18 -18
- package/builders/config-orchestrator.mjs +34 -34
- package/builders/project-links.mjs +50 -50
- package/builders/root-config-builder.mjs +61 -61
- package/builders/route-builders.mjs +136 -136
- package/builders/theme-template.mjs +76 -76
- package/builders/version-config-builder.mjs +186 -186
- package/content/docs-en.mjs +549 -549
- package/content/docs-es.mjs +462 -462
- package/content/docs-pt.mjs +462 -462
- package/contracts/doc-versions.mjs +3 -3
- package/data/default-site-config.mjs +321 -321
- package/data/i18n-langmenu.mjs +347 -347
- package/data/layouts.mjs +436 -436
- package/data/path-mappings.mjs +26 -26
- package/data/route-metas.mjs +93 -93
- package/data/theme-colors.mjs +443 -443
- package/data/urls.mjs +12 -12
- package/domain/models/cli-options.ts +33 -33
- package/home/constants.mjs +4 -4
- package/index.mjs +37 -37
- package/infrastructure/gitpagedocs-config-file.ts +47 -47
- package/infrastructure/home/runtime.mjs +37 -37
- package/package.json +3 -3
- package/presentation/commands/ai-info.ts +57 -57
- package/presentation/commands/config-clear.ts +23 -23
- package/presentation/commands/config-info.ts +24 -24
- package/presentation/commands/diagnostics.ts +164 -164
- package/presentation/commands/docs.ts +37 -37
- package/presentation/commands/mcp.ts +20 -20
- package/presentation/commands/pages.ts +101 -101
- package/presentation/commands/password.ts +62 -62
- package/presentation/commands/run-command.ts +70 -70
- package/presentation/index.ts +124 -124
- package/presentation/options/parser.ts +119 -119
- package/presentation/options/resolver.ts +46 -46
- package/presentation/ui/clack.ts +91 -91
- package/presentation/ui/prompts.ts +146 -146
- package/runtime/git-ops.mjs +110 -110
- package/runtime/output.mjs +159 -159
- package/runtime/workflow.mjs +129 -129
- package/start.mjs +12 -12
- package/ui/logger.mjs +9 -9
package/content/docs-en.mjs
CHANGED
|
@@ -1,549 +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
|
-
- \`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
|
-
};
|
|
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
|
+
};
|