@gitpagedocs/cli 1.1.55 → 1.1.58
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 +13 -1
- package/ai/application/run-ai-cli-command.ts +16 -5
- package/ai/core/models/parse-ai-cli-config.ts +78 -0
- package/ai/infrastructure/ai-config-file.ts +77 -8
- package/ai/infrastructure/file-system-adapter.ts +5 -3
- package/ai/presentation/ai-prompts.ts +1 -1
- package/application/report/config-only-reporter.mjs +63 -62
- package/builders/config-orchestrator.mjs +34 -34
- package/builders/project-links.mjs +26 -0
- package/builders/root-config-builder.mjs +11 -16
- package/builders/route-builders.mjs +136 -136
- package/builders/theme-template.mjs +76 -75
- package/builders/version-config-builder.mjs +186 -157
- package/content/docs-en.mjs +26 -24
- package/content/docs-es.mjs +20 -20
- package/content/docs-pt.mjs +20 -20
- package/contracts/doc-versions.mjs +3 -3
- package/contracts/index.mjs +0 -0
- package/data/i18n-langmenu.mjs +35 -35
- package/data/layouts.mjs +20 -0
- package/data/path-mappings.mjs +26 -26
- package/data/route-metas.mjs +93 -93
- package/data/theme-colors.mjs +8 -0
- package/data/urls.mjs +12 -7
- package/package.json +60 -60
- package/presentation/commands/config-clear.ts +23 -0
- package/presentation/commands/diagnostics.ts +1 -1
- package/presentation/commands/run-command.ts +6 -0
- package/presentation/index.ts +1 -1
- package/runtime/output.mjs +35 -35
- package/runtime/workflow.mjs +47 -27
- package/ui/logger.mjs +9 -9
package/runtime/output.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import {
|
|
@@ -15,37 +15,37 @@ function isWithin(parent, child) {
|
|
|
15
15
|
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const DEFAULT_ICON_SVG = `<?xml version="1.0" encoding="utf-8"?>
|
|
18
|
+
const DEFAULT_ICON_SVG = `<?xml version="1.0" encoding="utf-8"?>
|
|
19
19
|
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
20
20
|
<path opacity="0.1" fill-rule="evenodd" clip-rule="evenodd" d="M12 3C4.5885 3 3 4.5885 3 12C3 19.4115 4.5885 21 12 21C19.4115 21 21 19.4115 21 12C21 4.5885 19.4115 3 12 3ZM14.2695 9.03471C15.1872 8.34452 15.7204 8.25293 15.9299 8.25017C16.1326 8.86788 16.1588 9.54654 16.0042 10.1835C15.9945 10.2234 15.9842 10.263 15.9731 10.3025C15.941 10.4168 15.9647 10.5393 16.0366 10.6333L16.0377 10.6347C16.0521 10.6537 16.0664 10.6728 16.0805 10.6922C16.5194 11.2949 16.7603 12.0687 16.7497 12.8714L16.7496 12.8747C16.7496 14.5738 16.3076 15.5644 15.6994 16.1583C15.0859 16.7572 14.2627 16.9938 13.4137 17.0968L13.3898 17.0997L13.3777 17.1014C12.443 17.2601 11.5456 17.2688 10.6078 17.1286L10.604 17.1281L10.5687 17.1233C9.72415 17.0085 8.90483 16.7616 8.29455 16.1566C7.68912 15.5564 7.25036 14.5643 7.25038 12.8747L7.25034 12.8714C7.23972 12.0687 7.48056 11.2949 7.91949 10.6922C7.93482 10.6711 7.9504 10.6503 7.96621 10.6297C8.03648 10.538 8.05962 10.4184 8.02812 10.3068L8.02599 10.2993C8.01523 10.2608 8.00513 10.2222 7.99569 10.1834C7.84087 9.54684 7.86561 8.86863 8.0659 8.25016C8.27679 8.2528 8.81228 8.34432 9.73045 9.03473C9.76619 9.0616 9.80249 9.08937 9.83937 9.11807C9.93139 9.19 10.0529 9.21205 10.1644 9.17703L10.1657 9.17661C10.2268 9.15768 10.2882 9.13972 10.3496 9.12272C11.4349 8.82255 12.5651 8.82255 13.6504 9.12272C13.7088 9.13888 13.7671 9.15592 13.8253 9.17382L13.8277 9.17457C13.9431 9.21015 14.0704 9.18836 14.1678 9.11252C14.2022 9.08578 14.2361 9.05985 14.2695 9.03471Z" fill="#323232"/>
|
|
21
21
|
<path d="M13.717 8.88177C12.5881 8.56954 11.4119 8.56954 10.283 8.88177C10.2637 8.8871 10.2444 8.89254 10.2252 8.89808C10.1067 8.93218 9.97923 8.909 9.8807 8.83491V8.83491C8.69311 7.94193 8.07278 7.98181 7.91927 8.01161V8.01161C7.8946 8.0164 7.87585 8.03481 7.86732 8.05844C7.86516 8.06441 7.86303 8.07038 7.8609 8.07636C7.61639 8.76505 7.57904 9.52813 7.75277 10.2425C7.76289 10.2841 7.77371 10.3255 7.78525 10.3667C7.78601 10.3694 7.78677 10.3721 7.78753 10.3748C7.79754 10.4102 7.7902 10.4483 7.7678 10.4776V10.4776C7.75074 10.4998 7.73394 10.5223 7.71741 10.545C7.24479 11.1939 6.98907 12.0213 7.00036 12.8747C7.00036 16.3399 8.80396 17.1358 10.535 17.3711L10.5708 17.3758C11.5347 17.5199 12.4587 17.511 13.4195 17.3479L13.4438 17.345C15.1832 17.1339 16.9996 16.3587 16.9996 12.8747C17.0109 12.0213 16.7552 11.1939 16.2826 10.545C16.2674 10.5242 16.252 10.5035 16.2364 10.483C16.236 10.4825 16.2356 10.482 16.2352 10.4815C16.211 10.4498 16.203 10.4085 16.2138 10.3701V10.3701C16.2257 10.3277 16.2368 10.2852 16.2471 10.2425C16.421 9.52611 16.3815 8.76076 16.1329 8.07176C16.1313 8.06753 16.1298 8.06331 16.1283 8.05909C16.1195 8.03503 16.1004 8.01628 16.0752 8.01142V8.01142C15.921 7.98164 15.3041 7.94381 14.1193 8.83491V8.83491C14.0208 8.90896 13.8933 8.93197 13.7748 8.89804C13.7556 8.89252 13.7363 8.8871 13.717 8.88177Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
22
22
|
<path d="M3 12C3 4.5885 4.5885 3 12 3C19.4115 3 21 4.5885 21 12C21 19.4115 19.4115 21 12 21C4.5885 21 3 19.4115 3 12Z" stroke="#323232" stroke-width="2"/>
|
|
23
|
-
</svg>
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
function listExistingVersionIds(root, outputDir) {
|
|
27
|
-
const versionsRoot = path.join(root, outputDir, "docs", "versions");
|
|
28
|
-
if (!existsSync(versionsRoot)) return [];
|
|
29
|
-
return readdirSync(versionsRoot, { withFileTypes: true })
|
|
30
|
-
.filter((entry) => entry.isDirectory())
|
|
31
|
-
.map((entry) => entry.name);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function removeLegacySourceViewerFiles(root, outputDir) {
|
|
35
|
-
const versionIds = listExistingVersionIds(root, outputDir);
|
|
36
|
-
for (const versionId of versionIds) {
|
|
37
|
-
for (const language of ["pt", "en", "es"]) {
|
|
38
|
-
for (const fileName of ["source-viewer", "source-viewer.html"]) {
|
|
39
|
-
const legacyPath = path.join(root, outputDir, "docs", "versions", versionId, language, fileName);
|
|
40
|
-
if (existsSync(legacyPath)) {
|
|
41
|
-
rmSync(legacyPath, { force: true });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function writeJson(root, relativePath, data) {
|
|
23
|
+
</svg>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
function listExistingVersionIds(root, outputDir) {
|
|
27
|
+
const versionsRoot = path.join(root, outputDir, "docs", "versions");
|
|
28
|
+
if (!existsSync(versionsRoot)) return [];
|
|
29
|
+
return readdirSync(versionsRoot, { withFileTypes: true })
|
|
30
|
+
.filter((entry) => entry.isDirectory())
|
|
31
|
+
.map((entry) => entry.name);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function removeLegacySourceViewerFiles(root, outputDir) {
|
|
35
|
+
const versionIds = listExistingVersionIds(root, outputDir);
|
|
36
|
+
for (const versionId of versionIds) {
|
|
37
|
+
for (const language of ["pt", "en", "es"]) {
|
|
38
|
+
for (const fileName of ["source-viewer", "source-viewer.html"]) {
|
|
39
|
+
const legacyPath = path.join(root, outputDir, "docs", "versions", versionId, language, fileName);
|
|
40
|
+
if (existsSync(legacyPath)) {
|
|
41
|
+
rmSync(legacyPath, { force: true });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function writeJson(root, relativePath, data) {
|
|
49
49
|
const absolutePath = path.join(root, relativePath);
|
|
50
50
|
await mkdir(path.dirname(absolutePath), { recursive: true });
|
|
51
51
|
await writeFile(absolutePath, `${JSON.stringify(data, null, 2)}\n`, "utf-8");
|
|
@@ -93,13 +93,13 @@ export async function writeConfigOnlyOutput(options) {
|
|
|
93
93
|
rmSync(layoutsPath, { recursive: true, force: true });
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
for (const [versionId, versionConfig] of Object.entries(artifacts.versionConfigs)) {
|
|
97
|
-
await writeJson(root, `${outputDir}/docs/versions/${versionId}/config.json`, versionConfig);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
removeLegacySourceViewerFiles(root, outputDir);
|
|
101
|
-
|
|
102
|
-
for (const [versionId, versionConfig] of Object.entries(artifacts.versionConfigs)) {
|
|
96
|
+
for (const [versionId, versionConfig] of Object.entries(artifacts.versionConfigs)) {
|
|
97
|
+
await writeJson(root, `${outputDir}/docs/versions/${versionId}/config.json`, versionConfig);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
removeLegacySourceViewerFiles(root, outputDir);
|
|
101
|
+
|
|
102
|
+
for (const [versionId, versionConfig] of Object.entries(artifacts.versionConfigs)) {
|
|
103
103
|
const versionRoutesMd = versionConfig["routes-md"] ?? versionConfig.routes ?? [];
|
|
104
104
|
for (const route of versionRoutesMd) {
|
|
105
105
|
for (const docPath of Object.values(route.path ?? {})) {
|
package/runtime/workflow.mjs
CHANGED
|
@@ -6,23 +6,26 @@ function sanitizeDocsPath(docsPath) {
|
|
|
6
6
|
|
|
7
7
|
export async function ensureGitHubPagesWorkflow(getCurrentGitBranch, writeText, docsPath = "") {
|
|
8
8
|
const pathSegment = sanitizeDocsPath(docsPath);
|
|
9
|
-
const buildStepsBlock =
|
|
10
|
-
pathSegment
|
|
11
|
-
? ` - name: Build static site with target repository path
|
|
12
|
-
run: pnpm exec next build frontend && mv frontend/out out
|
|
13
|
-
working-directory: .gitpagedocs-runtime
|
|
14
|
-
env:
|
|
15
|
-
GITPAGEDOCS_PATH: "${pathSegment}"
|
|
16
|
-
|
|
17
|
-
- name: Relocate output to custom docs path
|
|
18
|
-
run: |
|
|
19
|
-
mkdir -p .gitpagedocs-runtime/out_new/${pathSegment}
|
|
9
|
+
const buildStepsBlock =
|
|
10
|
+
pathSegment
|
|
11
|
+
? ` - name: Build static site with target repository path
|
|
12
|
+
run: pnpm exec next build frontend && mv frontend/out out
|
|
13
|
+
working-directory: .gitpagedocs-runtime
|
|
14
|
+
env:
|
|
15
|
+
GITPAGEDOCS_PATH: "${pathSegment}"
|
|
16
|
+
|
|
17
|
+
- name: Relocate output to custom docs path
|
|
18
|
+
run: |
|
|
19
|
+
mkdir -p .gitpagedocs-runtime/out_new/${pathSegment}
|
|
20
20
|
mv .gitpagedocs-runtime/out/* .gitpagedocs-runtime/out_new/${pathSegment}/
|
|
21
21
|
rm -rf .gitpagedocs-runtime/out
|
|
22
|
-
mv .gitpagedocs-runtime/out_new .gitpagedocs-runtime/out
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
mv .gitpagedocs-runtime/out_new .gitpagedocs-runtime/out
|
|
23
|
+
|
|
24
|
+
- name: Redirect site root to custom docs path
|
|
25
|
+
run: printf '%s' '<!doctype html><meta http-equiv="refresh" content="0; url=./${pathSegment}/"><title>Redirecting</title><a href="./${pathSegment}/">Documentation</a>' > .gitpagedocs-runtime/out/index.html`
|
|
26
|
+
: ` - name: Build static site with target repository path
|
|
27
|
+
run: pnpm exec next build frontend && mv frontend/out out
|
|
28
|
+
working-directory: .gitpagedocs-runtime`;
|
|
26
29
|
const currentBranch = getCurrentGitBranch();
|
|
27
30
|
const workflowPath = ".github/workflows/gitpagedocs-pages.yml";
|
|
28
31
|
const workflowContent = `name: Deploy GitPageDocs
|
|
@@ -39,16 +42,20 @@ permissions:
|
|
|
39
42
|
|
|
40
43
|
concurrency:
|
|
41
44
|
group: "pages"
|
|
42
|
-
cancel-in-progress:
|
|
45
|
+
cancel-in-progress: false
|
|
43
46
|
|
|
44
47
|
jobs:
|
|
45
|
-
build:
|
|
46
|
-
runs-on: ubuntu-latest
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
build:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
permissions:
|
|
51
|
+
contents: read
|
|
52
|
+
pages: write
|
|
53
|
+
id-token: write
|
|
54
|
+
env:
|
|
55
|
+
GITHUB_ACTIONS: "true"
|
|
56
|
+
GITHUB_REPOSITORY: \${{ github.repository }}
|
|
57
|
+
GITPAGEDOCS_REPOSITORY_SEARCH: "true"
|
|
58
|
+
steps:
|
|
52
59
|
- name: Checkout target repository
|
|
53
60
|
uses: actions/checkout@v4
|
|
54
61
|
|
|
@@ -58,15 +65,21 @@ jobs:
|
|
|
58
65
|
- name: Setup Node
|
|
59
66
|
uses: actions/setup-node@v4
|
|
60
67
|
with:
|
|
61
|
-
node-version: "
|
|
68
|
+
node-version: "24"
|
|
62
69
|
|
|
63
70
|
- name: Setup Pages
|
|
64
71
|
uses: actions/configure-pages@v5
|
|
72
|
+
with:
|
|
73
|
+
enablement: true
|
|
65
74
|
|
|
66
75
|
- name: Prepare runtime source
|
|
67
76
|
run: |
|
|
68
77
|
git clone --depth 1 https://github.com/Vidigal-code/git-page-docs.git .gitpagedocs-runtime
|
|
69
78
|
cp .gitpagedocs-runtime/gitpagedocs/icon.svg /tmp/default-icon.svg 2>/dev/null || true
|
|
79
|
+
if [ -d gitpagelayouts ]; then
|
|
80
|
+
rm -rf .gitpagedocs-runtime/gitpagelayouts
|
|
81
|
+
cp -R gitpagelayouts .gitpagedocs-runtime/gitpagelayouts
|
|
82
|
+
fi
|
|
70
83
|
if [ -d gitpagedocs ]; then
|
|
71
84
|
rm -rf .gitpagedocs-runtime/gitpagedocs
|
|
72
85
|
cp -R gitpagedocs .gitpagedocs-runtime/gitpagedocs
|
|
@@ -84,9 +97,9 @@ jobs:
|
|
|
84
97
|
run: pnpm install --frozen-lockfile
|
|
85
98
|
working-directory: .gitpagedocs-runtime
|
|
86
99
|
|
|
87
|
-
${buildStepsBlock}
|
|
88
|
-
|
|
89
|
-
- name: Add .nojekyll
|
|
100
|
+
${buildStepsBlock}
|
|
101
|
+
|
|
102
|
+
- name: Add .nojekyll
|
|
90
103
|
run: touch .gitpagedocs-runtime/out/.nojekyll 2>/dev/null || mkdir -p .gitpagedocs-runtime/out && touch .gitpagedocs-runtime/out/.nojekyll
|
|
91
104
|
|
|
92
105
|
- name: Upload artifact
|
|
@@ -100,10 +113,17 @@ ${buildStepsBlock}
|
|
|
100
113
|
url: \${{ steps.deployment.outputs.page_url }}
|
|
101
114
|
runs-on: ubuntu-latest
|
|
102
115
|
needs: build
|
|
116
|
+
permissions:
|
|
117
|
+
pages: write
|
|
118
|
+
id-token: write
|
|
103
119
|
steps:
|
|
104
120
|
- name: Deploy to GitHub Pages
|
|
105
121
|
id: deployment
|
|
106
122
|
uses: actions/deploy-pages@v4
|
|
123
|
+
with:
|
|
124
|
+
timeout: 900000
|
|
125
|
+
error_count: 30
|
|
126
|
+
reporting_interval: 10000
|
|
107
127
|
`;
|
|
108
128
|
await writeText(workflowPath, workflowContent);
|
|
109
129
|
}
|
package/ui/logger.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** Consistent log formatting */
|
|
2
|
-
|
|
3
|
-
export function logSuccess(msg) {
|
|
4
|
-
console.log(`
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function logInfo(msg) {
|
|
8
|
-
console.log(` ${msg}`);
|
|
9
|
-
}
|
|
1
|
+
/** Consistent log formatting */
|
|
2
|
+
|
|
3
|
+
export function logSuccess(msg) {
|
|
4
|
+
console.log(` [ok] ${msg}`);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function logInfo(msg) {
|
|
8
|
+
console.log(` ${msg}`);
|
|
9
|
+
}
|