@gitpagedocs/tools 0.0.8 → 0.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitpagedocs/tools",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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",
@@ -40,7 +40,7 @@ export class GitPageDocsConfigLoader implements ConfigLoader {
40
40
  private async parse<TConfig>(resolvedPath: string, ext: ConfigExtension): Promise<TConfig> {
41
41
  if (ext === ".json") {
42
42
  const text = await readFile(resolvedPath, "utf8");
43
- return JSON.parse(text) as TConfig;
43
+ return JSON.parse(text.trimStart()) as TConfig;
44
44
  }
45
45
  if (ext === ".js" || ext === ".ts") {
46
46
  const mod = (await import(pathToFileURL(resolvedPath).href)) as Record<string, unknown>;
@@ -19,6 +19,7 @@ export const ROUTE_LIST_KEYS = [
19
19
  "routes-html",
20
20
  "routes-video",
21
21
  "routes-audio",
22
+ "routes-pdf",
22
23
  "routes",
23
24
  ] as const;
24
25
 
@@ -31,7 +31,71 @@ export interface CommandDoc {
31
31
  /** Markdown list of CLI commands. */
32
32
  export function cliCommandsSection(commands: readonly CommandDoc[]): string {
33
33
  const items = commands.map((c) => `- \`gitpagedocs ${c.name}\` — ${c.summary}`);
34
- return ["### CLI commands", "", ...items].join("\n");
34
+ return [
35
+ "### CLI commands",
36
+ "",
37
+ ...items,
38
+ "",
39
+ "### User references",
40
+ "",
41
+ "The generated documentation includes 23 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
+ "",
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
+ "",
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
+ "",
47
+ "`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
+ "",
49
+ "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
+ "",
51
+ "Document-footer controls use `DocumentPrevious` (`FiChevronLeft`) and `DocumentNext` (`FiChevronRight`); 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
+ "",
53
+ "`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
+ "",
55
+ "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
+ "",
57
+ "### PDF documents",
58
+ "",
59
+ "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.",
60
+ "",
61
+ "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
+ "",
63
+ "```json",
64
+ '{ "id": 23, "pdf": { "pathPdf": { "en": "gitpagedocs/docs/versions/0.0.10/en/gitpagedocs-project-guide.pdf", "pt": "gitpagedocs/docs/versions/0.0.10/en/gitpagedocs-project-guide.pdf", "es": "gitpagedocs/docs/versions/0.0.10/en/gitpagedocs-project-guide.pdf" }, "previewEnabled": true, "downloadEnabled": true, "openInNewTabEnabled": true } }',
65
+ "```",
66
+ "",
67
+ "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
+ "",
69
+ "PDF action icons are independent: `site.icons.PdfDownload` defaults to `FiDownload`, and `site.icons.PdfOpenInNewTab` defaults to `FiExternalLink`. 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
+ "",
71
+ "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
+ "",
73
+ "### HTML containers and the DOOM example",
74
+ "",
75
+ "The scaffold includes a local HTML demonstration with a title, description and an explicit load button for the externally hosted DOOM player. 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
+ "",
77
+ "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
+ "",
79
+ "```json",
80
+ "{",
81
+ ' "routes-html": [{',
82
+ ' "id": 29,',
83
+ ' "title": { "en": "DOOM: HTML example", "pt": "DOOM: exemplo HTML", "es": "DOOM: ejemplo HTML" },',
84
+ ' "description": { "en": "Load an interactive HTML demo", "pt": "Carregue uma demonstração HTML interativa", "es": "Carga una demostración HTML interactiva" },',
85
+ ' "titleIsVisible": true, "descriptionIsVisible": true, "container": "full",',
86
+ ' "path": { "en": "gitpagedocs/docs/versions/0.0.10/en/doom.html", "pt": "gitpagedocs/docs/versions/0.0.10/pt/doom.html", "es": "gitpagedocs/docs/versions/0.0.10/es/doom.html" }',
87
+ " }],",
88
+ ' "menus-header-html": [{',
89
+ ' "id": 29,',
90
+ ' "en": { "title": "DOOM: HTML example", "path-click": "gitpagedocs/docs/versions/0.0.10/en/doom.html" },',
91
+ ' "pt": { "title": "DOOM: exemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.10/pt/doom.html" },',
92
+ ' "es": { "title": "DOOM: ejemplo HTML", "path-click": "gitpagedocs/docs/versions/0.0.10/es/doom.html" }',
93
+ " }]",
94
+ "}",
95
+ "```",
96
+ "",
97
+ "Select the HTML menu entry and press its load button, then use the player's controls. Internet access and a compatible browser are required. The direct provider link remains available if embedding fails. 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
+ ].join("\n");
35
99
  }
36
100
 
37
101
  /** Markdown block documenting the monorepo dev workflow (deterministic). */
@@ -42,9 +106,9 @@ export function devWorkflowSection(): string {
42
106
  ["pnpm run lint", "lint the project"],
43
107
  ["pnpm run test:unit", "run the Vitest unit/integration suite"],
44
108
  ["pnpm run test:cov", "unit tests with coverage"],
45
- ["pnpm run test:e2e", "Playwright frontend E2E"],
109
+ ["pnpm exec cross-env PORT=3100 pnpm run test:e2e", "Playwright frontend E2E on ports 3100 and 3101"],
46
110
  ["pnpm run smoke:all", "CLI/contract/tools/mcp regression wall"],
47
- ["pnpm run build", "build the static site"],
111
+ ["pnpm run build", "build the Next.js production runtime; Pages export additionally requires its build environment"],
48
112
  ];
49
113
  return [
50
114
  "### Development",
@@ -77,7 +141,7 @@ export const CLI_COMMANDS: readonly CommandDoc[] = [
77
141
  { name: "models [provider]", summary: "list catalog models" },
78
142
  { name: "ai", summary: "interactive AI docs generator (writes pages in the gitpagedocs pattern)" },
79
143
  { name: "chat [question]", summary: "streaming AI chat in the terminal (REPL on a TTY; one-shot with a question or piped stdin)" },
80
- { name: "document[:repo|:file|:folder]", summary: "generate documentation with AI in the gitpagedocs pattern" },
144
+ { name: "document[:repo|:file|:folder]", summary: "aliases of the interactive documentation generator; select input directories in its prompts" },
81
145
  { name: "password", summary: "set a documentation access password (writes the public key to config.json)" },
82
146
  { name: "config clear", summary: "delete the stored .gitpagedocsconfig and the encrypted key vault" },
83
147
  { name: "docs", summary: "refresh the managed regions of README, CONTRIBUTING and SECURITY" },