@gitpagedocs/tools 0.0.10 → 0.0.12
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 +3 -2
- package/package.json +1 -1
- package/src/documentation/sections.ts +33 -13
package/README.md
CHANGED
|
@@ -11,16 +11,17 @@ The **shared business-logic core** of the [Git Page Docs](../README.md) monorepo
|
|
|
11
11
|
| `crypto/` | `NodeCryptoService` + `WebCryptoService` (SHA-256, PBKDF2, AES-256-GCM, masking, secure wipe); `deriveDocAccessKeys` / `verifyDocAccess` (double-hash documentation password gate shared by the CLI `password` command and the frontend gate) |
|
|
12
12
|
| `cache/` | `MemoryCache`, `FileCache`, `WebStorageCache` (Strategy over one `Cache` port) |
|
|
13
13
|
| `config/` | `GitPageDocsConfigLoader` (`.json` / `.js` / `.ts`) |
|
|
14
|
+
| `config-format/` | Browser-safe `compactSiteIcons` / `expandSiteIcons` and `applyRouteDefaults` / `factorRouteDefaults` for compact configuration and inherited route values |
|
|
14
15
|
| `logger/` | Level-filtered logger with **secret redaction** |
|
|
15
16
|
| `errors/` | `AppError` + typed subclasses |
|
|
16
|
-
| `filesystem/` | `FileService` (
|
|
17
|
+
| `filesystem/` | `FileService` (list/read/write/search with lexical root containment; filesystem symlinks/junctions still require trusted deployment boundaries) |
|
|
17
18
|
| `documentation/` | `DocumentationService`, `patchManagedRegion`, `DocUpdater` |
|
|
18
19
|
| `i18n/` | Language bundles (`site.languages` toggles in `config.json` + `langs/<lang>.json`): `loadConfigLanguageBundles`, `applyLanguageBundles` (fold into `site.langmenu` / `translations`), `filterEnabledLanguages`, `splitLanguageBundles` (generator side); browser-safe |
|
|
19
20
|
| `ports/` | Type-only contracts (logger, cache, crypto, security, config, ai) |
|
|
20
21
|
|
|
21
22
|
## Entry points (`exports`)
|
|
22
23
|
|
|
23
|
-
`.` (full barrel) · `./ai` · `./errors` · `./i18n` · `./ports` · `./crypto/web` · `./security/web` · `./cache/web` — the `web` subpaths and `./
|
|
24
|
+
`.` (full barrel) · `./ai` · `./errors` · `./i18n` · `./config-format` · `./ports` · `./crypto/web` · `./security/web` · `./cache/web` — the `web` subpaths, `./i18n` and `./config-format` are browser-safe (no `node:` imports) for the Next.js bundle.
|
|
24
25
|
|
|
25
26
|
## Usage
|
|
26
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitpagedocs/tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared business-logic core for Git Page Docs (consumed by frontend, cli and mcp). Ships TypeScript source; consume via tsx or a TS-aware bundler.",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -38,22 +38,33 @@ export function cliCommandsSection(commands: readonly CommandDoc[]): string {
|
|
|
38
38
|
"",
|
|
39
39
|
"### User references",
|
|
40
40
|
"",
|
|
41
|
-
"The generated documentation includes
|
|
41
|
+
"The generated documentation includes 32 Markdown pages per language: focused references plus complete configuration recipes, migration/compatibility, troubleshooting, contributing/testing and HTML-container guides. All pages are available in English, Portuguese and Spanish; Markdown filenames stay in English while titles and content preserve UTF-8 accents and special characters.",
|
|
42
|
+
"The scaffold registers documentation versions 0.0.12, 0.0.11 and 0.0.10 with the current examples; the npm package version is 0.0.12. Paths and version badges match each generated documentation version. Existing older version folders are preserved.",
|
|
42
43
|
"",
|
|
43
|
-
"The scaffold has real nested sections: Guides → Configure your site / Read and explore / Automate and integrate → documents, plus Operations and development and Git/GitHub groups. Getting Started and Project overview remain the first destinations. Recursive `submenus` can extend the hierarchy without a fixed depth limit; `site.nestedMenusEnabled: false` keeps every destination in a flat presentation.",
|
|
44
|
+
"The scaffold has real nested sections: Guides → Configure your site / Read and explore / Automate and integrate → documents, plus Operations and development and Git/GitHub groups. Getting Started and Project overview remain the first destinations. Every parent section has its own localized Markdown overview: click its title to read it, or use the separate arrow to expand children. Breadcrumb ancestors such as Guides → Configure your site remain navigable. Recursive `submenus` can extend the hierarchy without a fixed depth limit; `site.nestedMenusEnabled: false` keeps every destination in a flat presentation.",
|
|
44
45
|
"",
|
|
45
|
-
"Configure controls through `gitpagedocs/config.json` → `site.icons`. `LanguageSelector`, `ThemeSelector`, `FocusMode`, `QuickNavigation`, `PdfDownload`, `PdfOpenInNewTab`, `DocumentPrevious` and `DocumentNext` use icons by default. Set `reactIcon: false` independently to display text; `true` displays the icon. Customize `tag`, `size`, `colorDark` and `colorLight` per entry. Compact configs inherit omitted values from `icons.defaults`, so an omitted per-control `reactIcon` does not mean text mode. The Ctrl+K shortcut and accessible control names remain available.",
|
|
46
|
+
"Configure controls through `gitpagedocs/config.json` → `site.icons`. `LanguageSelector`, `ThemeSelector`, `VersionSelector`, `FocusMode`, `QuickNavigation`, `PdfDownload`, `PdfOpenInNewTab`, `DocumentPrevious` and `DocumentNext` use icons by default. Set `reactIcon: false` independently to display text; `true` displays the icon. Customize `tag`, `size`, `colorDark` and `colorLight` per entry. Compact configs inherit omitted values from `icons.defaults`, so an omitted per-control `reactIcon` does not mean text mode. The Ctrl+K shortcut and accessible control names remain available.",
|
|
47
|
+
"`VersionSelector` uses `LuGitBranch` by default; `reactIcon: false` displays the selected version as text. It appears only when more than one documentation version is available, retains the selector's localized accessible name and shows the selected version in its tooltip.",
|
|
46
48
|
"",
|
|
47
49
|
"`site.nestedMenusEnabled` selects recursive or flat navigation. Breadcrumbs use `RouteGuide` with route > version defaults > site precedence. `site.FocusMode` enables reading mode; `site.focusMode` controls copy, download, section navigation and document navigation independently.",
|
|
48
50
|
"",
|
|
49
51
|
"Focus mode provides eight navigation buttons: first, previous, next and last document, plus first, previous, next and last section. Each navigation flag controls its group of four; document changes keep the reader open and restart at the first section.",
|
|
50
52
|
"",
|
|
51
|
-
"Document-footer controls use `DocumentPrevious` (`
|
|
53
|
+
"Document-footer controls use `DocumentPrevious` (`LuChevronLeft`) and `DocumentNext` (`LuChevronRight`); either can use its translated text with `reactIcon: false`. The footer appears for multiple available menu destinations and disables unavailable directions. `site.ActiveNavigation` controls quick navigation and Ctrl+K separately.",
|
|
52
54
|
"",
|
|
53
55
|
"`site.accessibility.narration` configures native browser reading. Voices and offline availability depend on the browser and operating system. `site.mediaExclusivePlayback` coordinates narration, radio, audio and video so only one audible source plays by default.",
|
|
54
56
|
"",
|
|
55
57
|
"See [the MCP reference](mcp/README.md) for installation, client configuration, all 20 tools, all 7 resources, provider variables and limits. Start with `gitpagedocs mcp start` from the target project; on a source checkout the direct entry is `node --import tsx mcp/src/bin.ts`.",
|
|
56
58
|
"",
|
|
59
|
+
"### Animated themes",
|
|
60
|
+
"",
|
|
61
|
+
"The catalog contains 124 themes: 64 original themes, 20 standalone Motion backgrounds and 20 additional parallax families with dark and light variants (40 entries). All 84 earlier themes remain unchanged. Try `aurora-borealis-dark`/`aurora-borealis-light`, `firefly-grove-dark`/`firefly-grove-light`, or `ocean-depths-dark`/`ocean-depths-light`; the existing light/dark control switches within each pair. Each pair shares `supportsLightAndDarkModesReference` in the catalog. All themes are available through the official catalog and local `--layoutconfig` generation. See [the complete catalog](gitpagelayouts/README.md) and the generated Themes and layouts guide in English, Portuguese and Spanish.",
|
|
62
|
+
"",
|
|
63
|
+
"Customize `site.backgroundEffects` in `gitpagedocs/config.json`: `enabled: false` disables every background; `overrides` applies common settings; `themes[themeId]` applies theme-specific settings. Templates provide optional top-level `backgroundEffects`. Precedence is template → global overrides → per-theme overrides, while `layers` replaces the complete array. Adjust layer counts/colors, animation speed and pointer/scroll parallax without editing JavaScript. Reduced-motion preferences and a visitor pause control are supported; every new preset retains both protections.",
|
|
64
|
+
"Pause/resume sits beside the navigation lock in the documentation menu (expanded, collapsed and mobile), or in the search-page header. A manual pause survives menu and theme changes until Resume is selected. `site.backgroundEffects.overrides.accessibility.showPauseButton` defaults to `true`; `false` hides only the control. Configure `site.icons.BackgroundAnimationPause` (`FiPause`) and `BackgroundAnimationResume` (`FiPlay`) with `reactIcon`, `tag`, `size`, `colorDark` and `colorLight`. Defaults are icons, 22px and `currentColor`; `reactIcon: false` shows localized text. Use the background master switch to disable the effect itself.",
|
|
65
|
+
"",
|
|
66
|
+
"Preset sources live in `gitpagelayouts/v2/layouts/` as `overrides.backgroundEffects`. `pnpm run layouts:sync` expands templates and compiles the same presets into the CLI package; existing themes do not acquire an animation implicitly.",
|
|
67
|
+
"",
|
|
57
68
|
"### PDF documents",
|
|
58
69
|
"",
|
|
59
70
|
"Read or download the [GitPageDocs project guide (PDF, English)](cli/content/assets/gitpagedocs-project-guide.pdf). The CLI includes this real PDF in each generated version under `en/gitpagedocs-project-guide.pdf`; the example route points all three languages to the English document.",
|
|
@@ -61,18 +72,26 @@ export function cliCommandsSection(commands: readonly CommandDoc[]): string {
|
|
|
61
72
|
"Configure `site.pdf` with `enabled`, `previewEnabled`, `downloadEnabled` and `openInNewTabEnabled` (all default to `true`). The version config uses `routes-pdf`, `pdf.pathPdf` per language and `menus-header-pdf` with `page:23` for the bundled example. Route-level preview/download/new-tab options go inside `pdf`; `hierarchyPage.pdf` and `hierarchyMenu.pdf` order the content and menu sections.",
|
|
62
73
|
"",
|
|
63
74
|
"```json",
|
|
64
|
-
'{ "id": 23, "pdf": { "pathPdf": { "en": "gitpagedocs/docs/versions/0.0.
|
|
75
|
+
'{ "id": 23, "pdf": { "pathPdf": { "en": "gitpagedocs/docs/versions/0.0.12/en/gitpagedocs-project-guide.pdf", "pt": "gitpagedocs/docs/versions/0.0.12/en/gitpagedocs-project-guide.pdf", "es": "gitpagedocs/docs/versions/0.0.12/en/gitpagedocs-project-guide.pdf" }, "previewEnabled": true, "downloadEnabled": true, "openInNewTabEnabled": true } }',
|
|
65
76
|
"```",
|
|
66
77
|
"",
|
|
67
78
|
"The native browser viewer handles PDF previews and new tabs through validated `application/pdf` Blob URLs. Preview, download and new-tab actions all require CORS permission for external files. Opening a new tab does not navigate to the raw repository URL, so that server's Content-Type/Content-Disposition does not force a download. Browser PDF support and user preferences still apply. With preview disabled, the first download or new-tab action loads the PDF; cached bytes are reused. File/network errors and blocked pop-ups are reported without silently falling back to the raw URL.",
|
|
68
79
|
"",
|
|
69
|
-
"PDF action icons are independent: `site.icons.PdfDownload` defaults to `
|
|
80
|
+
"PDF action icons are independent: `site.icons.PdfDownload` defaults to `LuDownload`, and `site.icons.PdfOpenInNewTab` defaults to `LuExternalLink`. For example, `\"PdfDownload\": { \"reactIcon\": false }` shows download text while the new-tab control remains an icon. The `site.pdf` and route `pdf` action flags control availability separately from appearance.",
|
|
70
81
|
"",
|
|
71
82
|
"Next.js dev/build stages repository PDFs from `gitpagedocs/` into public assets and respects the Pages subpath; other local files must be in `frontend/public/`. See the generated PDF documents page for complete site, route, menu and icon examples.",
|
|
72
83
|
"",
|
|
84
|
+
"### Multiple ordered content blocks",
|
|
85
|
+
"",
|
|
86
|
+
"A version config can define `pages: [{ id: 39, blocks: [{ id: 'intro', type: 'md', routeId: 1 }, { id: 'repeat', type: 'md', routeId: 1 }] }]`. Use valid JSON with double quotes in the configuration. Block IDs are unique within a page; route references can repeat. The list order determines display order, independently of `hierarchyPage`. Supported types are `md`, `html`, `video`, `audio` and `pdf`; their sources and individual options remain in the corresponding `routes-*` arrays. Reference two route IDs pointing to the same file when two instances need different options.",
|
|
87
|
+
"",
|
|
88
|
+
"The example at `gitpagedocs/docs/versions/0.0.10/config.json` and the current scaffold use one destination, `page:39`, containing three Markdown blocks, two HTML blocks, two videos, two audio tracks and three PDFs. See the generated Ordered content blocks guide for the complete JSON, access behavior and compatibility rules. Existing pages without this array retain their behavior.",
|
|
89
|
+
"",
|
|
90
|
+
"Routes independently position their configured title and description through `layout.title` and `layout.description`: each accepts `placement: 'inside' | 'outside'` and `position: 'before' | 'after'`. Markdown always keeps configured labels outside its document while honoring before/after. Omitted layout preserves existing presentation. Existing visibility, alignment and CSS settings remain applicable.",
|
|
91
|
+
"",
|
|
73
92
|
"### HTML containers and the DOOM example",
|
|
74
93
|
"",
|
|
75
|
-
"The scaffold includes a local HTML demonstration
|
|
94
|
+
"The scaffold includes a local HTML demonstration whose outer documentation container supplies its title and description. The HTML itself contains only the externally hosted DOOM player, without duplicated prose or a custom load button. Game assets are not bundled. The wrapper is generated as `docs/versions/<version>/{en,pt,es}/doom.html`; the HTML containers guide explains sizing, external URLs and browser restrictions.",
|
|
76
95
|
"",
|
|
77
96
|
"Keep both `routes-html` and `menus-header-html` in the version configuration. Menu paths must match the localized HTML paths; local HTML does not use a `page:29` alias. Merge this example with existing arrays:",
|
|
78
97
|
"",
|
|
@@ -83,18 +102,18 @@ export function cliCommandsSection(commands: readonly CommandDoc[]): string {
|
|
|
83
102
|
' "title": { "en": "DOOM: HTML example", "pt": "DOOM: exemplo HTML", "es": "DOOM: ejemplo HTML" },',
|
|
84
103
|
' "description": { "en": "Load an interactive HTML demo", "pt": "Carregue uma demonstração HTML interativa", "es": "Carga una demostración HTML interactiva" },',
|
|
85
104
|
' "titleIsVisible": true, "descriptionIsVisible": true, "container": "full",',
|
|
86
|
-
' "path": { "en": "gitpagedocs/docs/versions/0.0.
|
|
105
|
+
' "path": { "en": "gitpagedocs/docs/versions/0.0.12/en/doom.html", "pt": "gitpagedocs/docs/versions/0.0.12/pt/doom.html", "es": "gitpagedocs/docs/versions/0.0.12/es/doom.html" }',
|
|
87
106
|
" }],",
|
|
88
107
|
' "menus-header-html": [{',
|
|
89
108
|
' "id": 29,',
|
|
90
|
-
' "en": { "title": "DOOM: HTML example", "path-click": "gitpagedocs/docs/versions/0.0.
|
|
91
|
-
' "pt": { "title": "DOOM: exemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.
|
|
92
|
-
' "es": { "title": "DOOM: ejemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.
|
|
109
|
+
' "en": { "title": "DOOM: HTML example", "path-click": "gitpagedocs/docs/versions/0.0.12/en/doom.html" },',
|
|
110
|
+
' "pt": { "title": "DOOM: exemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.12/pt/doom.html" },',
|
|
111
|
+
' "es": { "title": "DOOM: ejemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.12/es/doom.html" }',
|
|
93
112
|
" }]",
|
|
94
113
|
"}",
|
|
95
114
|
"```",
|
|
96
115
|
"",
|
|
97
|
-
"Select the HTML menu entry
|
|
116
|
+
"Select the HTML menu entry: the SDK loads when the page opens, and the native Play control starts the game. Internet access and a compatible browser are required. Bootstrap failures display an error asking you to reload the page. Only publish trusted HTML: the existing iframe permits scripts and same-origin content. Test keyboard access, mobile layout and the actual deployed Pages URL; external availability and framing policies remain controlled by the provider.",
|
|
98
117
|
].join("\n");
|
|
99
118
|
}
|
|
100
119
|
|
|
@@ -124,9 +143,10 @@ export function securityNoteSection(): string {
|
|
|
124
143
|
return [
|
|
125
144
|
"### API key handling",
|
|
126
145
|
"",
|
|
127
|
-
"-
|
|
146
|
+
"- Keys saved by the CLI or browser are **encrypted at rest** (AES-256-GCM, key derived with PBKDF2-HMAC-SHA-256) behind a local password. Keep environment-injected credentials in the host's secret facility.",
|
|
128
147
|
"- Site: the `/ai` console and the chat drawer keep the vault in `localStorage`; the drawer locks itself after `site.AiChatAutoLockSeconds` idle seconds (default 30) and asks for the password again.",
|
|
129
148
|
"- CLI: `gitpagedocs ai` / `gitpagedocs chat` seal the key in `.gitpagedocsvault` next to `.gitpagedocsconfig`; the vault password is created on first use and asked on every run (`GITPAGEDOCS_VAULT_PASSWORD` for non-interactive runs).",
|
|
149
|
+
"- MCP: provider calls read credentials from the server process environment. The server does not automatically load `.env` or unlock the CLI vault; use the MCP client's protected secret/input facility and restart it after environment changes.",
|
|
130
150
|
"- The password gates sensitive operations and is held only in memory for the session.",
|
|
131
151
|
"- Keys are **never logged** (the logger redacts secrets) and are sent only to the AI provider you select.",
|
|
132
152
|
"- To report a vulnerability, open a security advisory or issue on the repository.",
|