@gitpagedocs/cli 1.1.60 → 1.1.62

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 CHANGED
@@ -17,7 +17,9 @@ npx @gitpagedocs/cli
17
17
  | Command | Description |
18
18
  |---|---|
19
19
  | `gitpagedocs` | Generate `gitpagedocs/` config + versioned docs (config-only) |
20
- | `gitpagedocs --layoutconfig` | Also emit local layout templates in `gitpagedocs/layouts/` |
20
+ | `gitpagedocs --layoutconfig` | Also emit local layout templates in `gitpagelayouts/` |
21
+ | `gitpagedocs --layouts-dir <dir>` | Folder for local layouts (default: `gitpagelayouts`) |
22
+ | `gitpagedocs --no-interactive` / `-y` | Never prompt; use flags and defaults |
21
23
  | `gitpagedocs --push --owner <o> --repo <r> [--path <sub>]` | Generate, configure Pages, create workflow, commit + push |
22
24
  | `gitpagedocs --home` | Standalone distribution (`gitpagedocshome/`: static site + .env + Dockerfile) |
23
25
  | `gitpagedocs -i` / `--interactive` | Interactive prompts |
@@ -28,7 +30,7 @@ npx @gitpagedocs/cli
28
30
  | `gitpagedocs deploy` / `pages [actions\|deploy]` | Configure GitHub Pages via Actions + push |
29
31
  | `gitpagedocs docs` | Refresh managed regions of README/CONTRIBUTING/SECURITY |
30
32
  | `gitpagedocs config clear` | Delete the stored `.gitpagedocsconfig` (wipes saved AI credentials) |
31
- | `gitpagedocs doctor` · `version` · `update` | Diagnostics / version / update hint |
33
+ | `gitpagedocs doctor` · `version` · `update` | Diagnostics / version / registry update check |
32
34
  | `gitpagedocs mcp start` | Start the MCP server over stdio |
33
35
 
34
36
  The AI-CLI implementation lives in `cli/ai/` (relocated from the frontend so the published package is self-contained).
@@ -114,7 +116,7 @@ Generated artifacts include:
114
116
  Example:
115
117
 
116
118
  ```bash
117
- npx gitpagedocs --owner vidigal-code --repo energy-bill-ai-parser --path git-docs --push
119
+ npx @gitpagedocs/cli --owner vidigal-code --repo energy-bill-ai-parser --path git-docs --push
118
120
  ```
119
121
 
120
122
  Expected URL after deployment:
@@ -128,7 +130,7 @@ https://vidigal-code.github.io/energy-bill-ai-parser/git-docs/
128
130
  The CLI now includes a dedicated interactive AI mode:
129
131
 
130
132
  ```bash
131
- npx gitpagedocs ai
133
+ npx @gitpagedocs/cli ai
132
134
  ```
133
135
 
134
136
  ### What it does
@@ -162,7 +164,7 @@ permissions on POSIX systems:
162
164
  Set `GITPAGEDOCS_CONFIG_DIR` to override the directory; delete the stored file
163
165
  and its credentials with `gitpagedocs config clear`; a legacy
164
166
  `.gitpagedocsconfig` in the repository root is migrated automatically on the next
165
- run. You can create/edit this file manually and then run `npx gitpagedocs ai`:
167
+ run. You can create/edit this file manually and then run `npx @gitpagedocs/cli ai`:
166
168
 
167
169
  ```json
168
170
  {
@@ -24,6 +24,7 @@ export async function executeConfigOnly(params, runtime) {
24
24
 
25
25
  const artifacts = buildConfigArtifacts({
26
26
  useLocalLayoutConfig: options.useLocalLayoutConfig,
27
+ layoutsDir: options.layoutsDir,
27
28
  githubOwner: sanitizeSegment(options.githubOwner),
28
29
  githubRepo: sanitizeSegment(options.githubRepo),
29
30
  root,
@@ -33,6 +34,7 @@ export async function executeConfigOnly(params, runtime) {
33
34
  root,
34
35
  pkgRoot,
35
36
  outputDir: options.outputDir,
37
+ layoutsDir: options.layoutsDir,
36
38
  artifacts,
37
39
  useLocalLayoutConfig: options.useLocalLayoutConfig,
38
40
  layouts,
@@ -41,6 +41,7 @@ export async function executeHome(params, runtime) {
41
41
 
42
42
  const artifacts = buildConfigArtifacts({
43
43
  useLocalLayoutConfig: false,
44
+ layoutsDir: options.layoutsDir,
44
45
  githubOwner: "",
45
46
  githubRepo: "",
46
47
  root,
@@ -50,6 +51,7 @@ export async function executeHome(params, runtime) {
50
51
  root,
51
52
  pkgRoot,
52
53
  outputDir: ARTIFACTS_DIR,
54
+ layoutsDir: options.layoutsDir,
53
55
  artifacts,
54
56
  useLocalLayoutConfig: false,
55
57
  layouts,
@@ -2,6 +2,8 @@ import type { CliOptions } from "../../domain/models/cli-options";
2
2
 
3
3
  export interface BuildArtifactsInput {
4
4
  useLocalLayoutConfig: boolean;
5
+ /** Repo-relative layouts home the generated config should reference. */
6
+ layoutsDir: string;
5
7
  githubOwner: string;
6
8
  githubRepo: string;
7
9
  root: string;
@@ -44,6 +46,8 @@ export interface ConfigOnlyOutputInput {
44
46
  root: string;
45
47
  pkgRoot: string;
46
48
  outputDir: string;
49
+ /** Repo-relative layouts home local layouts are written to. */
50
+ layoutsDir: string;
47
51
  artifacts: BuiltConfigArtifacts;
48
52
  useLocalLayoutConfig: boolean;
49
53
  layouts: LayoutDefinition[];
@@ -1,16 +1,17 @@
1
1
  /** Config-only command output messages - SRP: single place for all report messages */
2
2
  import { resolveRenderingUrl } from "../../builders/project-links.mjs";
3
+ import { normalizeLayoutsDir } from "../../contracts/layouts-paths.mjs";
3
4
 
4
5
  export function reportConfigOnlySuccess(options) {
5
6
  return [`Generated: ${options.outputDir}/ (config-only)`, "No index.html/index.js generated."];
6
7
  }
7
8
 
8
9
  export function reportLayoutConfig(options) {
10
+ const layoutsDir = normalizeLayoutsDir(options.layoutsDir);
9
11
  if (options.useLocalLayoutConfig) {
10
- return ["Local layouts generated in gitpagedocs/layouts/ (--layoutconfig)."];
11
- } else {
12
- return ["Using official remote layouts config by default (no local gitpagedocs/layouts generated)."];
12
+ return [`Local layouts generated in ${layoutsDir}/ (--layoutconfig).`];
13
13
  }
14
+ return [`Using official remote layouts config by default (no local ${layoutsDir}/ generated).`];
14
15
  }
15
16
 
16
17
  export function reportRenderingUrl(options) {
@@ -1,6 +1,8 @@
1
1
  /** Shared derivation of project URLs from CLI options (single source of truth
2
2
  * for root and version config builders). */
3
3
 
4
+ import { layoutsArtifactPaths } from "../contracts/layouts-paths.mjs";
5
+
4
6
  export const DEFAULT_PROJECT_LINK = "https://github.com/Vidigal-code/git-page-docs";
5
7
  export const DEFAULT_RENDERING_URL = "https://vidigal-code.github.io/git-page-docs/";
6
8
 
@@ -16,6 +18,28 @@ export function resolveRenderingUrl(githubOwner, githubRepo) {
16
18
  : DEFAULT_RENDERING_URL;
17
19
  }
18
20
 
21
+ /**
22
+ * Where the viewer should look for locally generated layouts.
23
+ *
24
+ * Mirrors resolveSourceViewerPath: user repositories use the symbolic HEAD ref
25
+ * so any default branch resolves. Without an owner/repo pair there is no URL to
26
+ * build, so the repo-relative path is returned - the viewer reads it directly in
27
+ * local mode and still discovers it by probing the repository otherwise.
28
+ *
29
+ * @param {string} githubOwner
30
+ * @param {string} githubRepo
31
+ * @param {string} layoutsDir Repo-relative layouts home.
32
+ * @returns {{ config: string, templates: string }}
33
+ */
34
+ export function resolveLayoutsLinks(githubOwner, githubRepo, layoutsDir) {
35
+ const paths = layoutsArtifactPaths(layoutsDir);
36
+ if (!githubOwner || !githubRepo) {
37
+ return { config: paths.config, templates: paths.templates };
38
+ }
39
+ const base = `${resolveProjectLink(githubOwner, githubRepo)}/blob/HEAD`;
40
+ return { config: `${base}/${paths.config}`, templates: `${base}/${paths.templates}` };
41
+ }
42
+
19
43
  export function resolveSourceViewerPath(githubOwner, githubRepo) {
20
44
  // User repositories use the symbolic HEAD ref so any default branch works
21
45
  // (github.com, the trees API and raw.githubusercontent all accept it);
@@ -0,0 +1,16 @@
1
+ /** Options that shape the generated root config. */
2
+ export interface RootConfigOptions {
3
+ useLocalLayoutConfig?: boolean;
4
+ githubOwner?: string;
5
+ githubRepo?: string;
6
+ /** Repo-relative layouts home referenced by the generated config. */
7
+ layoutsDir?: string;
8
+ }
9
+
10
+ export interface RootConfig {
11
+ site: Record<string, unknown>;
12
+ VersionControl: { versions: Array<Record<string, unknown>> };
13
+ translations: Record<string, unknown>;
14
+ }
15
+
16
+ export declare function buildRootConfig(options?: RootConfigOptions): RootConfig;
@@ -1,6 +1,11 @@
1
1
  /** Build root config for gitpagedocs */
2
2
  import { OFFICIAL_LAYOUTS_CONFIG_URL, OFFICIAL_LAYOUTS_TEMPLATES_URL } from "../data/urls.mjs";
3
- import { resolveProjectLink, resolveRenderingUrl, resolveSourceViewerPath } from "./project-links.mjs";
3
+ import {
4
+ resolveProjectLink,
5
+ resolveRenderingUrl,
6
+ resolveSourceViewerPath,
7
+ resolveLayoutsLinks,
8
+ } from "./project-links.mjs";
4
9
  import { DOCS } from "../content/docs.mjs";
5
10
  import { DOC_VERSIONS } from "../data/version-constants.mjs";
6
11
  import { defaultLangMenu } from "../data/i18n-langmenu.mjs";
@@ -16,6 +21,7 @@ export function buildRootConfig(options = {}) {
16
21
  const renderingUrl = resolveRenderingUrl(githubOwner, githubRepo);
17
22
  const projectLink = resolveProjectLink(githubOwner, githubRepo);
18
23
  const sourceViewerPath = resolveSourceViewerPath(githubOwner, githubRepo);
24
+ const layoutsLinks = resolveLayoutsLinks(githubOwner, githubRepo, options.layoutsDir);
19
25
 
20
26
  const versionEntries = DOC_VERSIONS.map((id) => ({
21
27
  id,
@@ -39,6 +45,8 @@ export function buildRootConfig(options = {}) {
39
45
  layoutsConfigPathOficial: useOfficialLayouts,
40
46
  layoutsConfigPathTemplatesOficial: useOfficialLayouts ? OFFICIAL_LAYOUTS_TEMPLATES_URL : "",
41
47
  layoutsConfigPathOficialUrl: useOfficialLayouts ? OFFICIAL_LAYOUTS_CONFIG_URL : "",
48
+ layoutsConfigPath: useLocalLayoutConfig ? layoutsLinks.config : "",
49
+ layoutsConfigPathTemplates: useLocalLayoutConfig ? layoutsLinks.templates : "",
42
50
  repositorySearchHome,
43
51
  rendering: renderingUrl,
44
52
  AiChatEnabled: true,
@@ -21,8 +21,8 @@ The runtime expects this structure:
21
21
  - \`gitpagedocs/docs/<lang>/*.md\`
22
22
  - \`gitpagedocs/docs/versions/<version>/config.json\`
23
23
  - \`gitpagedocs/docs/versions/<version>/<lang>/*.md\`
24
- - \`gitpagedocs/layouts/layoutsConfig.json\`
25
- - \`gitpagedocs/layouts/templates/*.json\`
24
+ - \`gitpagelayouts/layoutsConfig.json\` (only with \`--layoutconfig\`)
25
+ - \`gitpagelayouts/templates/*.json\` (only with \`--layoutconfig\`)
26
26
 
27
27
  ## Quick navigation
28
28
 
@@ -46,11 +46,11 @@ This guide configures your repository from zero to running docs.
46
46
  ## Install and generate
47
47
 
48
48
  1. Install package:
49
- - \`npm install gitpagedocs\`
49
+ - \`npm install @gitpagedocs/cli\`
50
50
  2. Generate docs config and versions:
51
- - \`npx gitpagedocs\`
51
+ - \`npx @gitpagedocs/cli\`
52
52
  3. Optional: generate local layouts/templates:
53
- - \`npx gitpagedocs --layoutconfig\`
53
+ - \`npx @gitpagedocs/cli --layoutconfig\`
54
54
 
55
55
  ## Local run
56
56
 
@@ -62,7 +62,7 @@ This guide configures your repository from zero to running docs.
62
62
 
63
63
  ## CLI behavior
64
64
 
65
- \`npx gitpagedocs\` generates only artifacts in \`gitpagedocs/\`:
65
+ \`npx @gitpagedocs/cli\` generates only artifacts in \`gitpagedocs/\`:
66
66
 
67
67
  - JSON + markdown docs assets
68
68
  - No \`index.html\`
@@ -85,7 +85,7 @@ Git Page Docs is a **pnpm + turborepo monorepo** that turns a repository's \`git
85
85
  ## Monorepo packages
86
86
 
87
87
  - **frontend/** — Next.js 15 (App Router, React 19) documentation viewer, static-exported for GitHub Pages.
88
- - **cli/** — the published \`gitpagedocs\` npm package (\`npm install -g gitpagedocs\`): scaffolds the docs contract, generates docs with AI, configures Pages, and runs the MCP server.
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
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
90
  - **mcp/** — \`@gitpagedocs/mcp\`, a Model Context Protocol server (20 tools + 7 resources).
91
91
  - **gitpagedocs/** — the user contract: \`config.json\`, versioned docs, and layouts.
@@ -113,19 +113,20 @@ Complete reference of CLI options, configuration keys, and runtime features.
113
113
  | Command | Description |
114
114
  |---------|--------------|
115
115
  | \`gitpagedocs\` | Generate config and docs in \`gitpagedocs/\` |
116
- | \`gitpagedocs --layoutconfig\` | Also generate local layouts/templates |
116
+ | \`gitpagedocs --layoutconfig\` | Also generate local layouts/templates in \`gitpagelayouts/\` |
117
117
  | \`gitpagedocs --home\` | Standalone distribution (\`gitpagedocshome/\`) |
118
118
  | \`gitpagedocs --push --owner X --repo Y\` | Setup workflow, commit, push |
119
- | \`gitpagedocs --interactive\` / \`-i\` | Interactive mode with prompts |
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 |
120
121
  | \`gitpagedocs ai\` | Interactive AI documentation generator |
121
122
  | \`gitpagedocs provider [id]\` / \`models [provider]\` | List AI providers / catalog models |
122
123
  | \`gitpagedocs document[:repo\\|:file\\|:folder]\` | Generate documentation with AI |
123
124
  | \`gitpagedocs deploy\` / \`pages [actions\\|deploy]\` | Configure GitHub Pages via Actions + push |
124
125
  | \`gitpagedocs docs\` | Refresh README/CONTRIBUTING/SECURITY managed regions |
125
- | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / update hint |
126
+ | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / registry update check |
126
127
  | \`gitpagedocs mcp start\` | Start the MCP server over stdio |
127
128
 
128
- Install globally with \`npm install -g gitpagedocs\`, or run one-off with \`npx gitpagedocs\`.
129
+ Install globally with \`npm install -g @gitpagedocs/cli\`, or run one-off with \`npx @gitpagedocs/cli\`.
129
130
 
130
131
  ## CLI options
131
132
 
@@ -136,7 +137,8 @@ Install globally with \`npm install -g gitpagedocs\`, or run one-off with \`npx
136
137
  | \`--path <subpath>\` | Docs subpath (e.g. \`docs\`); without it, base path = repo name for correct CSS/JS on project sites |
137
138
  | \`--output <dir>\` | Output directory (default: \`gitpagedocs\`) |
138
139
  | \`--search true|false\` | Enable/disable repository search (\`--home\`) |
139
- | \`--layoutconfig\` | Generate \`gitpagedocs/layouts/\` |
140
+ | \`--layoutconfig\` | Generate local layouts in \`gitpagelayouts/\` |
141
+ | \`--layouts-dir <dir>\` | Folder for local layouts (default: \`gitpagelayouts\`) |
140
142
  | \`--push\` | Create workflow, commit artifacts, push |
141
143
  | \`--home\` | Generate \`gitpagedocshome/\` (static + .env + Dockerfile) |
142
144
 
@@ -146,7 +148,7 @@ Install globally with \`npm install -g gitpagedocs\`, or run one-off with \`npx
146
148
  - \`gitpagedocs/icon.svg\` – default icon
147
149
  - \`gitpagedocs/docs/versions/<ver>/config.json\` – per-version routes
148
150
  - \`gitpagedocs/docs/versions/<ver>/{en,pt,es}/*.md\` – markdown docs
149
- - \`gitpagedocs/layouts/\` – only with \`--layoutconfig\`
151
+ - \`gitpagelayouts/\` – only with \`--layoutconfig\` (folder configurable with \`--layouts-dir\`)
150
152
 
151
153
  ## Content types
152
154
 
@@ -419,8 +421,8 @@ Provide owner + repository to load docs from repositories that contain \`gitpage
419
421
  ## Self-hosted GitHub Pages
420
422
 
421
423
  1. Generate docs:
422
- - \`npx gitpagedocs\`
423
- - or \`npx gitpagedocs --layoutconfig\` for local templates
424
+ - \`npx @gitpagedocs/cli\`
425
+ - or \`npx @gitpagedocs/cli --layoutconfig\` for local templates
424
426
  2. Set \`site.rendering\` in \`gitpagedocs/config.json\`:
425
427
  - \`https://<your-user>.github.io/<your-repo>/\`
426
428
  3. Build and validate:
@@ -485,14 +487,16 @@ Themes are JSON templates mapped by \`layoutsConfig.json\`.
485
487
 
486
488
  ## Strategy options
487
489
 
488
- - Default mode (\`npx gitpagedocs\`): use official layouts/templates from the upstream repository.
489
- - Local mode (\`npx gitpagedocs --layoutconfig\`): generate and use local templates from your repository.
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.
490
492
 
491
493
  ## Local layout files
492
494
 
493
- - \`gitpagedocs/layouts/layoutsConfig.json\`
494
- - \`gitpagedocs/layouts/layoutsFallbackConfig.json\`
495
- - \`gitpagedocs/layouts/templates/*.json\`
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.
496
500
 
497
501
  ## Template model
498
502
 
@@ -19,8 +19,8 @@ El runtime espera esta estructura:
19
19
  - \`gitpagedocs/docs/<lang>/*.md\`
20
20
  - \`gitpagedocs/docs/versions/<version>/config.json\`
21
21
  - \`gitpagedocs/docs/versions/<version>/<lang>/*.md\`
22
- - \`gitpagedocs/layouts/layoutsConfig.json\`
23
- - \`gitpagedocs/layouts/templates/*.json\`
22
+ - \`gitpagelayouts/layoutsConfig.json\`
23
+ - \`gitpagelayouts/templates/*.json\`
24
24
 
25
25
  ## Navegacion rapida
26
26
 
@@ -55,7 +55,7 @@ Esta guia lleva el proyecto desde cero hasta docs corriendo.
55
55
 
56
56
  ## Comportamiento de la CLI
57
57
 
58
- \`npx gitpagedocs\` (o \`npm run gitpagedocs\`) genera artefactos en la carpeta oficial \`gitpagedocs/\`.
58
+ \`npx @gitpagedocs/cli\` (o \`npm run gitpagedocs\`) genera artefactos en la carpeta oficial \`gitpagedocs/\`.
59
59
 
60
60
  - Genera solo markdown/json
61
61
  - No genera \`index.html\`
@@ -78,7 +78,7 @@ Git Page Docs es un monorepo pnpm + turborepo que convierte la carpeta \`gitpage
78
78
  ## Paquetes del monorepo
79
79
 
80
80
  - **frontend/** — visor Next.js 15 (App Router, React 19), exportado estaticamente para GitHub Pages.
81
- - **cli/** — el paquete npm publicado \`gitpagedocs\` (\`npm install -g gitpagedocs\`): genera la estructura de docs, documenta con IA, configura Pages y ejecuta el servidor MCP.
81
+ - **cli/** — el paquete npm publicado \`@gitpagedocs/cli\` (\`npm install -g @gitpagedocs/cli\`): genera la estructura de docs, documenta con IA, configura Pages y ejecuta el servidor MCP.
82
82
  - **tools/** — \`@gitpagedocs/tools\`, el nucleo de logica compartido: sistema de IA con 14 proveedores, boveda de credenciales cifrada, cargador de config, caches y logger.
83
83
  - **mcp/** — \`@gitpagedocs/mcp\`, servidor Model Context Protocol (20 herramientas + 7 recursos).
84
84
  - **gitpagedocs/** — el contrato del usuario: \`config.json\`, docs versionados y layouts.
@@ -105,11 +105,12 @@ Referencia completa de opciones CLI, claves de configuracion y funciones del run
105
105
 
106
106
  | Comando | Descripcion |
107
107
  |---------|-------------|
108
- | \`npx gitpagedocs\` | Genera config y docs en \`gitpagedocs/\` |
109
- | \`npx gitpagedocs --layoutconfig\` | Tambien genera layouts/templates locales |
110
- | \`npx gitpagedocs --home\` | Distribucion standalone (\`gitpagedocshome/\`) |
111
- | \`npx gitpagedocs --push --owner X --repo Y\` | Configura workflow, commit, push |
112
- | \`npx gitpagedocs --interactive\` / \`-i\` | Modo interactivo con prompts |
108
+ | \`npx @gitpagedocs/cli\` | Genera config y docs en \`gitpagedocs/\` |
109
+ | \`npx @gitpagedocs/cli --layoutconfig\` | Tambien genera layouts/templates locales en \`gitpagelayouts/\` |
110
+ | \`npx @gitpagedocs/cli --home\` | Distribucion standalone (\`gitpagedocshome/\`) |
111
+ | \`npx @gitpagedocs/cli --push --owner X --repo Y\` | Configura workflow, commit, push |
112
+ | \`npx @gitpagedocs/cli --interactive\` / \`-i\` | Modo interactivo con prompts (por defecto en una terminal) |
113
+ | \`npx @gitpagedocs/cli --no-interactive\` / \`-y\` | Nunca pregunta; usa flags y valores por defecto |
113
114
 
114
115
  ## Opciones CLI
115
116
 
@@ -120,7 +121,8 @@ Referencia completa de opciones CLI, claves de configuracion y funciones del run
120
121
  | \`--path <subpath>\` | Subruta de docs (ej: \`docs\`); sin ella, base path = nombre del repo para CSS/JS en project sites |
121
122
  | \`--output <dir>\` | Directorio de salida (default: \`gitpagedocs\`) |
122
123
  | \`--search true|false\` | Habilita/deshabilita busqueda de repositorio (\`--home\`) |
123
- | \`--layoutconfig\` | Genera \`gitpagedocs/layouts/\` |
124
+ | \`--layoutconfig\` | Genera layouts locales en \`gitpagelayouts/\` |
125
+ | \`--layouts-dir <dir>\` | Carpeta de layouts locales (por defecto: \`gitpagelayouts\`) |
124
126
  | \`--push\` | Crea workflow, commit de artefactos, push |
125
127
  | \`--home\` | Genera \`gitpagedocshome/\` (estatico + .env + Dockerfile) |
126
128
 
@@ -130,7 +132,7 @@ Referencia completa de opciones CLI, claves de configuracion y funciones del run
130
132
  - \`gitpagedocs/icon.svg\` – icono por defecto
131
133
  - \`gitpagedocs/docs/versions/<ver>/config.json\` – rutas por version
132
134
  - \`gitpagedocs/docs/versions/<ver>/{en,pt,es}/*.md\` – docs en markdown
133
- - \`gitpagedocs/layouts/\` – solo con \`--layoutconfig\`
135
+ - \`gitpagelayouts/\` – solo con \`--layoutconfig\` (carpeta configurable con \`--layouts-dir\`)
134
136
 
135
137
  ## Tipos de contenido
136
138
 
@@ -400,9 +402,9 @@ Los temas son templates JSON mapeados por \`layoutsConfig.json\`.
400
402
 
401
403
  ## Archivos
402
404
 
403
- - \`gitpagedocs/layouts/layoutsConfig.json\`
404
- - \`gitpagedocs/layouts/layoutsFallbackConfig.json\`
405
- - \`gitpagedocs/layouts/templates/*.json\`
405
+ - \`gitpagelayouts/layoutsConfig.json\`
406
+ - \`gitpagelayouts/layoutsFallbackConfig.json\`
407
+ - \`gitpagelayouts/templates/*.json\`
406
408
 
407
409
  ## Modelo de template
408
410
 
@@ -19,8 +19,8 @@ O runtime espera esta estrutura:
19
19
  - \`gitpagedocs/docs/<lang>/*.md\`
20
20
  - \`gitpagedocs/docs/versions/<versao>/config.json\`
21
21
  - \`gitpagedocs/docs/versions/<versao>/<lang>/*.md\`
22
- - \`gitpagedocs/layouts/layoutsConfig.json\`
23
- - \`gitpagedocs/layouts/templates/*.json\`
22
+ - \`gitpagelayouts/layoutsConfig.json\`
23
+ - \`gitpagelayouts/templates/*.json\`
24
24
 
25
25
  ## Navegacao rapida
26
26
 
@@ -55,7 +55,7 @@ Este guia leva o projeto do zero ate docs rodando.
55
55
 
56
56
  ## Comportamento da CLI
57
57
 
58
- \`npx gitpagedocs\` (ou \`npm run gitpagedocs\`) gera os artefatos na pasta oficial \`gitpagedocs/\`.
58
+ \`npx @gitpagedocs/cli\` (ou \`npm run gitpagedocs\`) gera os artefatos na pasta oficial \`gitpagedocs/\`.
59
59
 
60
60
  - Gera somente markdown/json
61
61
  - Nao gera \`index.html\`
@@ -78,7 +78,7 @@ Git Page Docs e um monorepo pnpm + turborepo que transforma a pasta \`gitpagedoc
78
78
  ## Pacotes do monorepo
79
79
 
80
80
  - **frontend/** — visualizador Next.js 15 (App Router, React 19), exportado estaticamente para o GitHub Pages.
81
- - **cli/** — o pacote npm publicado \`gitpagedocs\` (\`npm install -g gitpagedocs\`): gera a estrutura de docs, documenta com IA, configura o Pages e roda o servidor MCP.
81
+ - **cli/** — o pacote npm publicado \`@gitpagedocs/cli\` (\`npm install -g @gitpagedocs/cli\`): gera a estrutura de docs, documenta com IA, configura o Pages e roda o servidor MCP.
82
82
  - **tools/** — \`@gitpagedocs/tools\`, o nucleo de logica compartilhado: sistema de IA com 14 provedores, cofre de credenciais criptografado, loader de config, caches e logger.
83
83
  - **mcp/** — \`@gitpagedocs/mcp\`, servidor Model Context Protocol (20 ferramentas + 7 recursos).
84
84
  - **gitpagedocs/** — o contrato do usuario: \`config.json\`, docs versionados e layouts.
@@ -105,11 +105,12 @@ Referencia completa de opcoes da CLI, chaves de configuracao e recursos do runti
105
105
 
106
106
  | Comando | Descricao |
107
107
  |---------|------------|
108
- | \`npx gitpagedocs\` | Gera config e docs em \`gitpagedocs/\` |
109
- | \`npx gitpagedocs --layoutconfig\` | Tambem gera layouts/templates locais |
110
- | \`npx gitpagedocs --home\` | Distribuicao standalone (\`gitpagedocshome/\`) |
111
- | \`npx gitpagedocs --push --owner X --repo Y\` | Configura workflow, commit, push |
112
- | \`npx gitpagedocs --interactive\` / \`-i\` | Modo interativo com prompts |
108
+ | \`npx @gitpagedocs/cli\` | Gera config e docs em \`gitpagedocs/\` |
109
+ | \`npx @gitpagedocs/cli --layoutconfig\` | Tambem gera layouts/templates locais em \`gitpagelayouts/\` |
110
+ | \`npx @gitpagedocs/cli --home\` | Distribuicao standalone (\`gitpagedocshome/\`) |
111
+ | \`npx @gitpagedocs/cli --push --owner X --repo Y\` | Configura workflow, commit, push |
112
+ | \`npx @gitpagedocs/cli --interactive\` / \`-i\` | Modo interativo com prompts (padrao em um terminal) |
113
+ | \`npx @gitpagedocs/cli --no-interactive\` / \`-y\` | Nunca pergunta; usa flags e padroes |
113
114
 
114
115
  ## Opcoes da CLI
115
116
 
@@ -120,7 +121,8 @@ Referencia completa de opcoes da CLI, chaves de configuracao e recursos do runti
120
121
  | \`--path <subpath>\` | Subcaminho dos docs (ex: \`docs\`); sem ele, base path = nome do repo para CSS/JS em project sites |
121
122
  | \`--output <dir>\` | Diretorio de saida (padrao: \`gitpagedocs\`) |
122
123
  | \`--search true|false\` | Habilita/desabilita busca de repositorio (\`--home\`) |
123
- | \`--layoutconfig\` | Gera \`gitpagedocs/layouts/\` |
124
+ | \`--layoutconfig\` | Gera layouts locais em \`gitpagelayouts/\` |
125
+ | \`--layouts-dir <dir>\` | Pasta dos layouts locais (padrao: \`gitpagelayouts\`) |
124
126
  | \`--push\` | Cria workflow, commit de artefatos, push |
125
127
  | \`--home\` | Gera \`gitpagedocshome/\` (estatico + .env + Dockerfile) |
126
128
 
@@ -130,7 +132,7 @@ Referencia completa de opcoes da CLI, chaves de configuracao e recursos do runti
130
132
  - \`gitpagedocs/icon.svg\` – icone padrao
131
133
  - \`gitpagedocs/docs/versions/<ver>/config.json\` – rotas por versao
132
134
  - \`gitpagedocs/docs/versions/<ver>/{en,pt,es}/*.md\` – docs em markdown
133
- - \`gitpagedocs/layouts/\` – apenas com \`--layoutconfig\`
135
+ - \`gitpagelayouts/\` – apenas com \`--layoutconfig\` (pasta configuravel com \`--layouts-dir\`)
134
136
 
135
137
  ## Tipos de conteudo
136
138
 
@@ -400,9 +402,9 @@ Temas sao templates JSON mapeados por \`layoutsConfig.json\`.
400
402
 
401
403
  ## Arquivos
402
404
 
403
- - \`gitpagedocs/layouts/layoutsConfig.json\`
404
- - \`gitpagedocs/layouts/layoutsFallbackConfig.json\`
405
- - \`gitpagedocs/layouts/templates/*.json\`
405
+ - \`gitpagelayouts/layoutsConfig.json\`
406
+ - \`gitpagelayouts/layoutsFallbackConfig.json\`
407
+ - \`gitpagelayouts/templates/*.json\`
406
408
 
407
409
  ## Modelo de template
408
410
 
@@ -1,3 +1,3 @@
1
- export const PACKAGE_VERSION = "1.1.60";
1
+ export const PACKAGE_VERSION = "1.1.62";
2
2
 
3
3
  export const DOC_VERSIONS = [PACKAGE_VERSION];
@@ -1 +1,11 @@
1
1
  export { DOC_VERSIONS } from "./doc-versions.mjs";
2
+ export {
3
+ DEFAULT_LAYOUTS_DIR,
4
+ LAYOUTS_CONFIG_FILENAME,
5
+ LAYOUTS_FALLBACK_CONFIG_FILENAME,
6
+ LAYOUTS_TEMPLATES_DIRNAME,
7
+ LEGACY_LAYOUTS_SUBDIR,
8
+ normalizeLayoutsDir,
9
+ legacyLayoutsDir,
10
+ layoutsArtifactPaths,
11
+ } from "./layouts-paths.mjs";
@@ -0,0 +1,17 @@
1
+ /** Repo-relative paths owned by a layouts folder. */
2
+ export interface LayoutsArtifactPaths {
3
+ root: string;
4
+ config: string;
5
+ fallbackConfig: string;
6
+ templates: string;
7
+ }
8
+
9
+ export declare const DEFAULT_LAYOUTS_DIR: string;
10
+ export declare const LAYOUTS_CONFIG_FILENAME: string;
11
+ export declare const LAYOUTS_FALLBACK_CONFIG_FILENAME: string;
12
+ export declare const LAYOUTS_TEMPLATES_DIRNAME: string;
13
+ export declare const LEGACY_LAYOUTS_SUBDIR: string;
14
+
15
+ export declare function normalizeLayoutsDir(dir: string): string;
16
+ export declare function legacyLayoutsDir(outputDir: string): string;
17
+ export declare function layoutsArtifactPaths(layoutsDir: string): LayoutsArtifactPaths;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Canonical locations for layout artifacts.
3
+ *
4
+ * Local layouts are generated into the standalone `gitpagelayouts/` home at the
5
+ * project root. `<outputDir>/layouts/` is the legacy location that earlier
6
+ * versions wrote: the viewer still reads it, and the CLI offers to migrate it,
7
+ * but nothing is generated there any more.
8
+ *
9
+ * Every consumer derives its paths from here so the folder name exists in one
10
+ * place only.
11
+ */
12
+
13
+ /** Standalone layouts home, relative to the project root. */
14
+ export const DEFAULT_LAYOUTS_DIR = "gitpagelayouts";
15
+
16
+ /** Index file listing every layout, inside a layouts folder. */
17
+ export const LAYOUTS_CONFIG_FILENAME = "layoutsConfig.json";
18
+
19
+ /** Fallback index used when a layout id cannot be resolved. */
20
+ export const LAYOUTS_FALLBACK_CONFIG_FILENAME = "layoutsFallbackConfig.json";
21
+
22
+ /** Folder holding one JSON template per layout, inside a layouts folder. */
23
+ export const LAYOUTS_TEMPLATES_DIRNAME = "templates";
24
+
25
+ /** Sub-folder of the docs output dir that older versions generated into. */
26
+ export const LEGACY_LAYOUTS_SUBDIR = "layouts";
27
+
28
+ /**
29
+ * Normalize a user-supplied folder name to a repo-relative POSIX path with no
30
+ * leading/trailing separators, so it can be joined and stored in config.json
31
+ * identically on every platform.
32
+ *
33
+ * @param {string} dir Raw folder name (may use either separator).
34
+ * @returns {string} Normalized path, or `DEFAULT_LAYOUTS_DIR` when empty.
35
+ */
36
+ export function normalizeLayoutsDir(dir) {
37
+ const normalized = String(dir ?? "")
38
+ .replace(/[\\/]+/g, "/")
39
+ .replace(/^\/+|\/+$/g, "")
40
+ .trim();
41
+ return normalized || DEFAULT_LAYOUTS_DIR;
42
+ }
43
+
44
+ /**
45
+ * Legacy layouts folder for a given docs output dir.
46
+ *
47
+ * @param {string} outputDir Docs output dir (e.g. `gitpagedocs`).
48
+ * @returns {string} Repo-relative POSIX path (e.g. `gitpagedocs/layouts`).
49
+ */
50
+ export function legacyLayoutsDir(outputDir) {
51
+ return `${normalizeLayoutsDir(outputDir)}/${LEGACY_LAYOUTS_SUBDIR}`;
52
+ }
53
+
54
+ /**
55
+ * Repo-relative paths of every artifact a layouts folder owns.
56
+ *
57
+ * @param {string} layoutsDir Layouts folder, repo-relative.
58
+ * @returns {{ root: string, config: string, fallbackConfig: string, templates: string }}
59
+ */
60
+ export function layoutsArtifactPaths(layoutsDir) {
61
+ const root = normalizeLayoutsDir(layoutsDir);
62
+ return {
63
+ root,
64
+ config: `${root}/${LAYOUTS_CONFIG_FILENAME}`,
65
+ fallbackConfig: `${root}/${LAYOUTS_FALLBACK_CONFIG_FILENAME}`,
66
+ templates: `${root}/${LAYOUTS_TEMPLATES_DIRNAME}`,
67
+ };
68
+ }
@@ -1,11 +1,25 @@
1
1
  export type CliMode = "home" | "full" | "config-only" | "ai";
2
2
 
3
+ /**
4
+ * Values the user supplied explicitly on the command line. Interactive mode
5
+ * only asks for what is missing, so an explicit flag is never re-asked.
6
+ */
7
+ export interface CliExplicitFlags {
8
+ useLocalLayoutConfig: boolean;
9
+ layoutsDir: boolean;
10
+ githubOwner: boolean;
11
+ githubRepo: boolean;
12
+ outputDir: boolean;
13
+ }
14
+
3
15
  export interface CliOptions {
4
16
  isBuild: boolean;
5
17
  isServe: boolean;
6
18
  mode: CliMode;
7
19
  aiCommand?: string;
8
20
  outputDir: string;
21
+ /** Standalone layouts home (repo-relative); local layouts are generated here. */
22
+ layoutsDir: string;
9
23
  useLocalLayoutConfig: boolean;
10
24
  shouldPush: boolean;
11
25
  githubOwner: string;
@@ -15,4 +29,5 @@ export interface CliOptions {
15
29
  repositorySearch?: boolean;
16
30
  isInteractive: boolean;
17
31
  hasArgs: boolean;
32
+ explicit: CliExplicitFlags;
18
33
  }
@@ -0,0 +1,15 @@
1
+ /** A planned move from the legacy layouts folder to the standalone home. */
2
+ export interface LayoutsMigrationPlan {
3
+ required: boolean;
4
+ from: string;
5
+ to: string;
6
+ files: string[];
7
+ overwrites: string[];
8
+ }
9
+
10
+ export declare function planLayoutsMigration(options: {
11
+ outputDir: string;
12
+ layoutsDir: string;
13
+ legacyFiles?: string[];
14
+ targetFiles?: string[];
15
+ }): LayoutsMigrationPlan;