@gitpagedocs/cli 1.1.59 → 1.1.61

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
@@ -28,7 +28,7 @@ npx @gitpagedocs/cli
28
28
  | `gitpagedocs deploy` / `pages [actions\|deploy]` | Configure GitHub Pages via Actions + push |
29
29
  | `gitpagedocs docs` | Refresh managed regions of README/CONTRIBUTING/SECURITY |
30
30
  | `gitpagedocs config clear` | Delete the stored `.gitpagedocsconfig` (wipes saved AI credentials) |
31
- | `gitpagedocs doctor` · `version` · `update` | Diagnostics / version / update hint |
31
+ | `gitpagedocs doctor` · `version` · `update` | Diagnostics / version / registry update check |
32
32
  | `gitpagedocs mcp start` | Start the MCP server over stdio |
33
33
 
34
34
  The AI-CLI implementation lives in `cli/ai/` (relocated from the frontend so the published package is self-contained).
@@ -114,7 +114,7 @@ Generated artifacts include:
114
114
  Example:
115
115
 
116
116
  ```bash
117
- npx gitpagedocs --owner vidigal-code --repo energy-bill-ai-parser --path git-docs --push
117
+ npx @gitpagedocs/cli --owner vidigal-code --repo energy-bill-ai-parser --path git-docs --push
118
118
  ```
119
119
 
120
120
  Expected URL after deployment:
@@ -128,7 +128,7 @@ https://vidigal-code.github.io/energy-bill-ai-parser/git-docs/
128
128
  The CLI now includes a dedicated interactive AI mode:
129
129
 
130
130
  ```bash
131
- npx gitpagedocs ai
131
+ npx @gitpagedocs/cli ai
132
132
  ```
133
133
 
134
134
  ### What it does
@@ -162,7 +162,7 @@ permissions on POSIX systems:
162
162
  Set `GITPAGEDOCS_CONFIG_DIR` to override the directory; delete the stored file
163
163
  and its credentials with `gitpagedocs config clear`; a legacy
164
164
  `.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`:
165
+ run. You can create/edit this file manually and then run `npx @gitpagedocs/cli ai`:
166
166
 
167
167
  ```json
168
168
  {
@@ -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.
@@ -122,10 +122,10 @@ Complete reference of CLI options, configuration keys, and runtime features.
122
122
  | \`gitpagedocs document[:repo\\|:file\\|:folder]\` | Generate documentation with AI |
123
123
  | \`gitpagedocs deploy\` / \`pages [actions\\|deploy]\` | Configure GitHub Pages via Actions + push |
124
124
  | \`gitpagedocs docs\` | Refresh README/CONTRIBUTING/SECURITY managed regions |
125
- | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / update hint |
125
+ | \`gitpagedocs doctor\` / \`version\` / \`update\` | Diagnostics / version / registry update check |
126
126
  | \`gitpagedocs mcp start\` | Start the MCP server over stdio |
127
127
 
128
- Install globally with \`npm install -g gitpagedocs\`, or run one-off with \`npx gitpagedocs\`.
128
+ Install globally with \`npm install -g @gitpagedocs/cli\`, or run one-off with \`npx @gitpagedocs/cli\`.
129
129
 
130
130
  ## CLI options
131
131
 
@@ -419,8 +419,8 @@ Provide owner + repository to load docs from repositories that contain \`gitpage
419
419
  ## Self-hosted GitHub Pages
420
420
 
421
421
  1. Generate docs:
422
- - \`npx gitpagedocs\`
423
- - or \`npx gitpagedocs --layoutconfig\` for local templates
422
+ - \`npx @gitpagedocs/cli\`
423
+ - or \`npx @gitpagedocs/cli --layoutconfig\` for local templates
424
424
  2. Set \`site.rendering\` in \`gitpagedocs/config.json\`:
425
425
  - \`https://<your-user>.github.io/<your-repo>/\`
426
426
  3. Build and validate:
@@ -485,8 +485,8 @@ Themes are JSON templates mapped by \`layoutsConfig.json\`.
485
485
 
486
486
  ## Strategy options
487
487
 
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.
488
+ - Default mode (\`npx @gitpagedocs/cli\`): use official layouts/templates from the upstream repository.
489
+ - Local mode (\`npx @gitpagedocs/cli --layoutconfig\`): generate and use local templates from your repository.
490
490
 
491
491
  ## Local layout files
492
492
 
@@ -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,11 @@ 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 |
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 |
113
113
 
114
114
  ## Opciones CLI
115
115
 
@@ -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,11 @@ 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 |
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 |
113
113
 
114
114
  ## Opcoes da CLI
115
115
 
@@ -1,3 +1,3 @@
1
- export const PACKAGE_VERSION = "1.1.59";
1
+ export const PACKAGE_VERSION = "1.1.61";
2
2
 
3
3
  export const DOC_VERSIONS = [PACKAGE_VERSION];
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitpagedocs/cli",
3
- "version": "1.1.59",
3
+ "version": "1.1.61",
4
4
  "description": "CLI that scaffolds and maintains gitpagedocs documentation, generates docs with AI, configures GitHub Pages, and runs the MCP server.",
5
5
  "bin": {
6
6
  "gitpagedocs": "index.mjs"
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@clack/prompts": "^1.5.1",
32
- "@gitpagedocs/mcp": "^1.1.59",
33
- "@gitpagedocs/tools": "^1.1.59",
32
+ "@gitpagedocs/mcp": "^1.1.61",
33
+ "@gitpagedocs/tools": "^1.1.61",
34
34
  "tsx": "^4.21.0"
35
35
  },
36
36
  "repository": {
@@ -57,14 +57,108 @@ export async function runDoctor(ctx: CommandContext): Promise<void> {
57
57
  console.log(`\n ${failed === 0 ? "All required checks passed." : `${failed} check(s) need attention.`}\n`);
58
58
  }
59
59
 
60
+ /** Used only when package.json is unreadable — the CLI's published name. */
61
+ const FALLBACK_PACKAGE = "@gitpagedocs/cli";
62
+ /** The bin this package installs; shown alongside the package name. */
63
+ const BIN_NAME = "gitpagedocs";
64
+
65
+ interface PackageIdentity {
66
+ name: string;
67
+ version: string;
68
+ }
69
+
70
+ /**
71
+ * Read the identity from the installed package.json rather than hardcoding it,
72
+ * so the hint always names the package the user actually has. A hardcoded name
73
+ * is how `update` ended up advertising an unpublished package.
74
+ */
75
+ function readPackageIdentity(pkgRoot: string): PackageIdentity {
76
+ try {
77
+ const pkg = JSON.parse(readFileSync(path.join(pkgRoot, "package.json"), "utf8"));
78
+ const name = typeof pkg.name === "string" && pkg.name.length > 0 ? pkg.name : FALLBACK_PACKAGE;
79
+ return { name, version: String(pkg.version ?? "unknown") };
80
+ } catch {
81
+ return { name: FALLBACK_PACKAGE, version: "unknown" };
82
+ }
83
+ }
84
+
85
+ type RegistryLookup =
86
+ | { status: "ok"; latest: string }
87
+ | { status: "missing" }
88
+ | { status: "unreachable" };
89
+
90
+ function registryBase(): string {
91
+ const configured = process.env.npm_config_registry || "https://registry.npmjs.org";
92
+ return configured.endsWith("/") ? configured.slice(0, -1) : configured;
93
+ }
94
+
95
+ /** Resolve the dist-tag `latest` for a package. Never throws. */
96
+ async function fetchLatest(name: string, timeoutMs = 6000): Promise<RegistryLookup> {
97
+ const encoded = name.split("/").map(encodeURIComponent).join("/");
98
+ try {
99
+ const response = await fetch(`${registryBase()}/${encoded}/latest`, {
100
+ signal: AbortSignal.timeout(timeoutMs),
101
+ });
102
+ if (response.status === 404) return { status: "missing" };
103
+ if (!response.ok) return { status: "unreachable" };
104
+ const body = (await response.json()) as { version?: unknown };
105
+ if (typeof body.version === "string" && body.version.length > 0) {
106
+ return { status: "ok", latest: body.version };
107
+ }
108
+ return { status: "unreachable" };
109
+ } catch {
110
+ return { status: "unreachable" };
111
+ }
112
+ }
113
+
114
+ /** Numeric version compare, prerelease suffix ignored. */
115
+ function compareVersions(a: string, b: string): number {
116
+ const parts = (value: string): number[] =>
117
+ value.split("-")[0].split(".").map((piece) => Number.parseInt(piece, 10) || 0);
118
+ const left = parts(a);
119
+ const right = parts(b);
120
+ for (let i = 0; i < Math.max(left.length, right.length); i += 1) {
121
+ const diff = (left[i] ?? 0) - (right[i] ?? 0);
122
+ if (diff !== 0) return diff < 0 ? -1 : 1;
123
+ }
124
+ return 0;
125
+ }
126
+
60
127
  export async function runUpdate(ctx: CommandContext): Promise<void> {
61
- const current = readVersion(ctx.pkgRoot);
128
+ const { name, version } = readPackageIdentity(ctx.pkgRoot);
129
+ const lookup = await fetchLatest(name);
130
+ const label = name === BIN_NAME ? `${BIN_NAME} ${version}` : `${BIN_NAME} ${version} (${name})`;
131
+ const lines = ["", ` Installed: ${label}`];
132
+
133
+ if (lookup.status === "ok") {
134
+ lines.push(` Latest: ${lookup.latest}`);
135
+ } else if (lookup.status === "missing") {
136
+ lines.push(` Latest: unavailable — the registry has no published ${name}`);
137
+ } else {
138
+ lines.push(" Latest: unknown — could not reach the npm registry");
139
+ }
140
+
141
+ if (lookup.status === "missing") {
142
+ lines.push(
143
+ "",
144
+ " Nothing can be installed under that name. If the package was renamed",
145
+ " or unpublished, check the current one:",
146
+ " https://www.npmjs.com/package/@gitpagedocs/cli",
147
+ );
148
+ } else if (lookup.status === "ok" && compareVersions(version, lookup.latest) >= 0) {
149
+ lines.push("", " Already on the latest published version.");
150
+ } else {
151
+ const target = lookup.status === "ok" ? lookup.latest : "latest";
152
+ lines.push(
153
+ "",
154
+ " To update the global CLI:",
155
+ ` npm i -g ${name}@${target}`,
156
+ " Or, in a project:",
157
+ ` pnpm add -D ${name}@${target}`,
158
+ );
159
+ }
160
+
161
+ lines.push("");
62
162
  // eslint-disable-next-line no-console
63
- console.log(
64
- `\n Installed: gitpagedocs ${current}\n` +
65
- " To update the global CLI:\n" +
66
- " npm i -g gitpagedocs@latest\n" +
67
- " Or, in a project:\n" +
68
- " pnpm add -D gitpagedocs@latest\n",
69
- );
163
+ console.log(lines.join("\n"));
70
164
  }