@gitpagedocs/cli 1.1.61 → 1.1.63

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.
Files changed (72) hide show
  1. package/README.md +193 -191
  2. package/ai/application/ai-command.ts +24 -24
  3. package/ai/application/ai-provider-factory.ts +22 -22
  4. package/ai/application/docs-pattern.ts +68 -68
  5. package/ai/application/run-ai-cli-command.ts +167 -167
  6. package/ai/config.ts +50 -50
  7. package/ai/core/models/ai-cli-config.ts +33 -33
  8. package/ai/core/models/parse-ai-cli-config.ts +78 -78
  9. package/ai/core/ports/illm-provider.ts +32 -32
  10. package/ai/infrastructure/ai-config-file.ts +101 -101
  11. package/ai/infrastructure/file-system-adapter.ts +85 -85
  12. package/ai/infrastructure/llm/tools-llm-provider.ts +54 -54
  13. package/ai/infrastructure/version-docs-writer.ts +143 -143
  14. package/ai/presentation/ai-prompts.ts +239 -239
  15. package/application/config-only/handler.mjs +2 -0
  16. package/application/home/handler.mjs +2 -0
  17. package/application/ports/cli-runtime-ports.ts +91 -87
  18. package/application/report/config-only-reporter.mjs +64 -63
  19. package/application/use-cases/dispatch-mode.ts +18 -18
  20. package/builders/config-orchestrator.mjs +34 -34
  21. package/builders/project-links.mjs +50 -26
  22. package/builders/root-config-builder.d.mts +16 -0
  23. package/builders/root-config-builder.mjs +61 -53
  24. package/builders/route-builders.mjs +136 -136
  25. package/builders/theme-template.mjs +76 -76
  26. package/builders/version-config-builder.mjs +186 -186
  27. package/content/docs-en.mjs +549 -545
  28. package/content/docs-es.mjs +462 -460
  29. package/content/docs-pt.mjs +462 -460
  30. package/contracts/doc-versions.mjs +3 -3
  31. package/contracts/index.mjs +10 -0
  32. package/contracts/layouts-paths.d.mts +17 -0
  33. package/contracts/layouts-paths.mjs +68 -0
  34. package/data/default-site-config.mjs +321 -321
  35. package/data/i18n-langmenu.mjs +347 -347
  36. package/data/layouts.mjs +436 -436
  37. package/data/path-mappings.mjs +26 -26
  38. package/data/route-metas.mjs +93 -93
  39. package/data/theme-colors.mjs +443 -443
  40. package/data/urls.mjs +12 -12
  41. package/domain/models/cli-options.ts +33 -18
  42. package/domain/services/layouts-migration.d.mts +15 -0
  43. package/domain/services/layouts-migration.mjs +60 -0
  44. package/home/constants.mjs +4 -4
  45. package/index.mjs +37 -37
  46. package/infrastructure/gitpagedocs-config-file.ts +47 -47
  47. package/infrastructure/home/runtime.mjs +37 -37
  48. package/package.json +3 -3
  49. package/presentation/commands/ai-info.ts +57 -57
  50. package/presentation/commands/config-clear.ts +23 -23
  51. package/presentation/commands/config-info.ts +24 -24
  52. package/presentation/commands/diagnostics.ts +164 -164
  53. package/presentation/commands/docs.ts +37 -37
  54. package/presentation/commands/mcp.ts +20 -20
  55. package/presentation/commands/pages.ts +101 -101
  56. package/presentation/commands/password.ts +62 -62
  57. package/presentation/commands/run-command.ts +70 -70
  58. package/presentation/index.ts +124 -116
  59. package/presentation/options/parser.ts +119 -104
  60. package/presentation/options/resolver.ts +46 -48
  61. package/presentation/options/schema.ts +4 -0
  62. package/presentation/ui/clack.ts +91 -91
  63. package/presentation/ui/layouts-prompts.ts +124 -0
  64. package/presentation/ui/prompts.ts +146 -138
  65. package/presentation/ui/tty.ts +37 -0
  66. package/runtime/git-ops.mjs +110 -110
  67. package/runtime/layouts-migrator.d.mts +11 -0
  68. package/runtime/layouts-migrator.mjs +103 -0
  69. package/runtime/output.mjs +159 -146
  70. package/runtime/workflow.mjs +129 -129
  71. package/start.mjs +12 -12
  72. package/ui/logger.mjs +9 -9
@@ -1,186 +1,186 @@
1
- /** Build version config (routes, menus) for each doc version */
2
-
3
- import {
4
- ROUTE_PATHS,
5
- VIDEO_IDS,
6
- AUDIO_IDS,
7
- PAGE2_AUDIO,
8
- } from "../data/path-mappings.mjs";
9
- import {
10
- ROUTE_META_ID1,
11
- ROUTE_META_ID2,
12
- ROUTE_META_ID3,
13
- ROUTE_META_ID4,
14
- ROUTE_META_ID5,
15
- ROUTE_META_ID6,
16
- VIDEO_META_ID1,
17
- VIDEO_META_ID2,
18
- VIDEO_META_ID3,
19
- VIDEO_META_ID4,
20
- AUDIO_META_ID12,
21
- SOURCE_VIEWER_META,
22
- DEFAULT_HIERARCHY,
23
- } from "../data/route-metas.mjs";
24
- import { buildAudioRoute, buildMdRoute, buildSourceViewerRoute, buildVideoRoute } from "./route-builders.mjs";
25
- import { resolveSourceViewerPath } from "./project-links.mjs";
26
-
27
- /** Demo route protections showcasing the "Authorized Routes" feature. They are
28
- * applied only to the official (non-parameterized) scaffold — user sites
29
- * generated with --owner/--repo stay public, since visitors of those sites
30
- * have no discoverable unlock recipe. */
31
- const EXTERNAL_AUTH_PROVIDERS = ["authjs", "clerk", "firebase", "jwt"];
32
- const DOCS_ACCESS_KEY_ID = "docs-key";
33
- const MAINTAINER_ROLE = "maintainer";
34
- const VIDEO_ROUTE_AUTHORIZATION = {
35
- requireExternalAuth: true,
36
- allowedProviders: EXTERNAL_AUTH_PROVIDERS,
37
- };
38
-
39
- const ROUTE_METAS = {
40
- 1: ROUTE_META_ID1,
41
- 2: ROUTE_META_ID2,
42
- 3: ROUTE_META_ID3,
43
- 4: ROUTE_META_ID4,
44
- 5: ROUTE_META_ID5,
45
- 6: ROUTE_META_ID6,
46
- };
47
- const VIDEO_METAS = { 1: VIDEO_META_ID1, 2: VIDEO_META_ID2, 3: VIDEO_META_ID3, 4: VIDEO_META_ID4 };
48
-
49
- function buildVersionMdRoutes(versionId, includeDemoAuthorization) {
50
- const base = `gitpagedocs/docs/versions/${versionId}`;
51
- return [1, 2, 3, 4, 5, 6].map((id) => {
52
- const paths = ROUTE_PATHS[id];
53
- const meta = ROUTE_METAS[id];
54
- const pathByLang = {
55
- pt: `${base}/pt/${paths.pt}`,
56
- en: `${base}/en/${paths.en}`,
57
- es: `${base}/es/${paths.es}`,
58
- };
59
- const routeOptions = {
60
- ...(id === 2 ? { audio: PAGE2_AUDIO } : {}),
61
- ...(includeDemoAuthorization && id === 3
62
- ? { authorization: { requiredRoles: [MAINTAINER_ROLE] } }
63
- : {}),
64
- ...(includeDemoAuthorization && id === 6
65
- ? {
66
- authorization: {
67
- accessKeyId: DOCS_ACCESS_KEY_ID,
68
- requiredRoles: [MAINTAINER_ROLE],
69
- requireExternalAuth: true,
70
- allowedProviders: EXTERNAL_AUTH_PROVIDERS,
71
- },
72
- }
73
- : {}),
74
- };
75
- return buildMdRoute(versionId, id, pathByLang, meta.titles, meta.descriptions, routeOptions);
76
- });
77
- }
78
-
79
- function buildVersionVideoRoutes(versionId, includeDemoAuthorization) {
80
- return [1, 2, 3, 4].map((id) =>
81
- buildVideoRoute(
82
- versionId,
83
- id + 7,
84
- "youtube",
85
- VIDEO_IDS[id - 1],
86
- VIDEO_METAS[id].title,
87
- VIDEO_METAS[id].description,
88
- includeDemoAuthorization ? { authorization: VIDEO_ROUTE_AUTHORIZATION } : {},
89
- )
90
- );
91
- }
92
-
93
- function buildVersionAudioRoutes(versionId) {
94
- return [
95
- buildAudioRoute(
96
- versionId,
97
- AUDIO_META_ID12.id,
98
- "youtube",
99
- AUDIO_IDS[0],
100
- AUDIO_META_ID12.title,
101
- AUDIO_META_ID12.description,
102
- ),
103
- ];
104
- }
105
-
106
- function buildVersionSourceViewerRoutes(options = {}) {
107
- return [
108
- buildSourceViewerRoute(
109
- SOURCE_VIEWER_META.id,
110
- resolveSourceViewerPath(options.githubOwner, options.githubRepo),
111
- SOURCE_VIEWER_META.titles,
112
- SOURCE_VIEWER_META.descriptions,
113
- ),
114
- ];
115
- }
116
-
117
- function buildVersionMenus(versionId) {
118
- const base = `gitpagedocs/docs/versions/${versionId}`;
119
- const menuMd = [1, 2, 3, 4, 5, 6].map((id) => ({
120
- id,
121
- pt: { title: ROUTE_METAS[id].titles.pt, "path-click": `${base}/pt/${ROUTE_PATHS[id].pt}` },
122
- en: { title: ROUTE_METAS[id].titles.en, "path-click": `${base}/en/${ROUTE_PATHS[id].en}` },
123
- es: { title: ROUTE_METAS[id].titles.es, "path-click": `${base}/es/${ROUTE_PATHS[id].es}` },
124
- }));
125
- const menuVideo = [1, 2, 3, 4].map((id) => ({
126
- id: id + 7,
127
- pt: { title: `${VIDEO_METAS[id].title.pt.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
128
- en: { title: `${VIDEO_METAS[id].title.en.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
129
- es: { title: `${VIDEO_METAS[id].title.es.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
130
- }));
131
- const menuAudio = [
132
- {
133
- id: AUDIO_META_ID12.id,
134
- pt: { title: AUDIO_META_ID12.title.pt, "path-click": `page:${AUDIO_META_ID12.id}` },
135
- en: { title: AUDIO_META_ID12.title.en, "path-click": `page:${AUDIO_META_ID12.id}` },
136
- es: { title: AUDIO_META_ID12.title.es, "path-click": `page:${AUDIO_META_ID12.id}` },
137
- },
138
- ];
139
- const menuSourceViewer = [
140
- {
141
- id: SOURCE_VIEWER_META.id,
142
- pt: { title: SOURCE_VIEWER_META.titles.pt, "path-click": `page:${SOURCE_VIEWER_META.id}` },
143
- en: { title: SOURCE_VIEWER_META.titles.en, "path-click": `page:${SOURCE_VIEWER_META.id}` },
144
- es: { title: SOURCE_VIEWER_META.titles.es, "path-click": `page:${SOURCE_VIEWER_META.id}` },
145
- },
146
- ];
147
- return { md: menuMd, sourceViewer: menuSourceViewer, html: [], video: menuVideo, audio: menuAudio };
148
- }
149
-
150
- /**
151
- * Build version config for a single doc version.
152
- * @param {string} versionId - e.g. "1.1.54"
153
- * @param {object} [options] - { githubOwner, githubRepo } for the source-viewer link
154
- * @returns {object} Version config with routes, menus, and hierarchy
155
- */
156
- export function buildVersionConfig(versionId, options = {}) {
157
- const includeDemoAuthorization = !options.githubOwner && !options.githubRepo;
158
- const menus = buildVersionMenus(versionId);
159
-
160
- return {
161
- auth: {
162
- accessKeys: {
163
- "docs-key": "open-gitpagedocs-docs",
164
- },
165
- rolesStorageKey: "git-page-docs:route-auth:roles",
166
- providers: [
167
- { type: "authjs", enabled: true, sessionEndpoint: "/api/auth/session", rolesClaimPath: "user.roles" },
168
- { type: "clerk", enabled: true, rolesClaimPath: "claims.publicMetadata.roles" },
169
- { type: "firebase", enabled: true, tokenStorageKey: "git-page-docs:firebase-token", rolesClaimPath: "roles" },
170
- { type: "jwt", enabled: true, tokenStorageKey: "git-page-docs:jwt-token", rolesClaimPath: "roles" },
171
- ],
172
- },
173
- "routes-md": buildVersionMdRoutes(versionId, includeDemoAuthorization),
174
- "routes-source-viewer": buildVersionSourceViewerRoutes(options),
175
- "routes-html": [],
176
- "routes-video": buildVersionVideoRoutes(versionId, includeDemoAuthorization),
177
- "routes-audio": buildVersionAudioRoutes(versionId),
178
- "menus-header-md": menus.md,
179
- "menus-header-source-viewer": menus.sourceViewer,
180
- "menus-header-html": menus.html,
181
- "menus-header-video": menus.video,
182
- "menus-header-audio": menus.audio,
183
- hierarchyPage: DEFAULT_HIERARCHY,
184
- hierarchyMenu: DEFAULT_HIERARCHY,
185
- };
186
- }
1
+ /** Build version config (routes, menus) for each doc version */
2
+
3
+ import {
4
+ ROUTE_PATHS,
5
+ VIDEO_IDS,
6
+ AUDIO_IDS,
7
+ PAGE2_AUDIO,
8
+ } from "../data/path-mappings.mjs";
9
+ import {
10
+ ROUTE_META_ID1,
11
+ ROUTE_META_ID2,
12
+ ROUTE_META_ID3,
13
+ ROUTE_META_ID4,
14
+ ROUTE_META_ID5,
15
+ ROUTE_META_ID6,
16
+ VIDEO_META_ID1,
17
+ VIDEO_META_ID2,
18
+ VIDEO_META_ID3,
19
+ VIDEO_META_ID4,
20
+ AUDIO_META_ID12,
21
+ SOURCE_VIEWER_META,
22
+ DEFAULT_HIERARCHY,
23
+ } from "../data/route-metas.mjs";
24
+ import { buildAudioRoute, buildMdRoute, buildSourceViewerRoute, buildVideoRoute } from "./route-builders.mjs";
25
+ import { resolveSourceViewerPath } from "./project-links.mjs";
26
+
27
+ /** Demo route protections showcasing the "Authorized Routes" feature. They are
28
+ * applied only to the official (non-parameterized) scaffold — user sites
29
+ * generated with --owner/--repo stay public, since visitors of those sites
30
+ * have no discoverable unlock recipe. */
31
+ const EXTERNAL_AUTH_PROVIDERS = ["authjs", "clerk", "firebase", "jwt"];
32
+ const DOCS_ACCESS_KEY_ID = "docs-key";
33
+ const MAINTAINER_ROLE = "maintainer";
34
+ const VIDEO_ROUTE_AUTHORIZATION = {
35
+ requireExternalAuth: true,
36
+ allowedProviders: EXTERNAL_AUTH_PROVIDERS,
37
+ };
38
+
39
+ const ROUTE_METAS = {
40
+ 1: ROUTE_META_ID1,
41
+ 2: ROUTE_META_ID2,
42
+ 3: ROUTE_META_ID3,
43
+ 4: ROUTE_META_ID4,
44
+ 5: ROUTE_META_ID5,
45
+ 6: ROUTE_META_ID6,
46
+ };
47
+ const VIDEO_METAS = { 1: VIDEO_META_ID1, 2: VIDEO_META_ID2, 3: VIDEO_META_ID3, 4: VIDEO_META_ID4 };
48
+
49
+ function buildVersionMdRoutes(versionId, includeDemoAuthorization) {
50
+ const base = `gitpagedocs/docs/versions/${versionId}`;
51
+ return [1, 2, 3, 4, 5, 6].map((id) => {
52
+ const paths = ROUTE_PATHS[id];
53
+ const meta = ROUTE_METAS[id];
54
+ const pathByLang = {
55
+ pt: `${base}/pt/${paths.pt}`,
56
+ en: `${base}/en/${paths.en}`,
57
+ es: `${base}/es/${paths.es}`,
58
+ };
59
+ const routeOptions = {
60
+ ...(id === 2 ? { audio: PAGE2_AUDIO } : {}),
61
+ ...(includeDemoAuthorization && id === 3
62
+ ? { authorization: { requiredRoles: [MAINTAINER_ROLE] } }
63
+ : {}),
64
+ ...(includeDemoAuthorization && id === 6
65
+ ? {
66
+ authorization: {
67
+ accessKeyId: DOCS_ACCESS_KEY_ID,
68
+ requiredRoles: [MAINTAINER_ROLE],
69
+ requireExternalAuth: true,
70
+ allowedProviders: EXTERNAL_AUTH_PROVIDERS,
71
+ },
72
+ }
73
+ : {}),
74
+ };
75
+ return buildMdRoute(versionId, id, pathByLang, meta.titles, meta.descriptions, routeOptions);
76
+ });
77
+ }
78
+
79
+ function buildVersionVideoRoutes(versionId, includeDemoAuthorization) {
80
+ return [1, 2, 3, 4].map((id) =>
81
+ buildVideoRoute(
82
+ versionId,
83
+ id + 7,
84
+ "youtube",
85
+ VIDEO_IDS[id - 1],
86
+ VIDEO_METAS[id].title,
87
+ VIDEO_METAS[id].description,
88
+ includeDemoAuthorization ? { authorization: VIDEO_ROUTE_AUTHORIZATION } : {},
89
+ )
90
+ );
91
+ }
92
+
93
+ function buildVersionAudioRoutes(versionId) {
94
+ return [
95
+ buildAudioRoute(
96
+ versionId,
97
+ AUDIO_META_ID12.id,
98
+ "youtube",
99
+ AUDIO_IDS[0],
100
+ AUDIO_META_ID12.title,
101
+ AUDIO_META_ID12.description,
102
+ ),
103
+ ];
104
+ }
105
+
106
+ function buildVersionSourceViewerRoutes(options = {}) {
107
+ return [
108
+ buildSourceViewerRoute(
109
+ SOURCE_VIEWER_META.id,
110
+ resolveSourceViewerPath(options.githubOwner, options.githubRepo),
111
+ SOURCE_VIEWER_META.titles,
112
+ SOURCE_VIEWER_META.descriptions,
113
+ ),
114
+ ];
115
+ }
116
+
117
+ function buildVersionMenus(versionId) {
118
+ const base = `gitpagedocs/docs/versions/${versionId}`;
119
+ const menuMd = [1, 2, 3, 4, 5, 6].map((id) => ({
120
+ id,
121
+ pt: { title: ROUTE_METAS[id].titles.pt, "path-click": `${base}/pt/${ROUTE_PATHS[id].pt}` },
122
+ en: { title: ROUTE_METAS[id].titles.en, "path-click": `${base}/en/${ROUTE_PATHS[id].en}` },
123
+ es: { title: ROUTE_METAS[id].titles.es, "path-click": `${base}/es/${ROUTE_PATHS[id].es}` },
124
+ }));
125
+ const menuVideo = [1, 2, 3, 4].map((id) => ({
126
+ id: id + 7,
127
+ pt: { title: `${VIDEO_METAS[id].title.pt.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
128
+ en: { title: `${VIDEO_METAS[id].title.en.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
129
+ es: { title: `${VIDEO_METAS[id].title.es.slice(0, 40)}...`, "path-click": `page:${id + 7}` },
130
+ }));
131
+ const menuAudio = [
132
+ {
133
+ id: AUDIO_META_ID12.id,
134
+ pt: { title: AUDIO_META_ID12.title.pt, "path-click": `page:${AUDIO_META_ID12.id}` },
135
+ en: { title: AUDIO_META_ID12.title.en, "path-click": `page:${AUDIO_META_ID12.id}` },
136
+ es: { title: AUDIO_META_ID12.title.es, "path-click": `page:${AUDIO_META_ID12.id}` },
137
+ },
138
+ ];
139
+ const menuSourceViewer = [
140
+ {
141
+ id: SOURCE_VIEWER_META.id,
142
+ pt: { title: SOURCE_VIEWER_META.titles.pt, "path-click": `page:${SOURCE_VIEWER_META.id}` },
143
+ en: { title: SOURCE_VIEWER_META.titles.en, "path-click": `page:${SOURCE_VIEWER_META.id}` },
144
+ es: { title: SOURCE_VIEWER_META.titles.es, "path-click": `page:${SOURCE_VIEWER_META.id}` },
145
+ },
146
+ ];
147
+ return { md: menuMd, sourceViewer: menuSourceViewer, html: [], video: menuVideo, audio: menuAudio };
148
+ }
149
+
150
+ /**
151
+ * Build version config for a single doc version.
152
+ * @param {string} versionId - e.g. "1.1.54"
153
+ * @param {object} [options] - { githubOwner, githubRepo } for the source-viewer link
154
+ * @returns {object} Version config with routes, menus, and hierarchy
155
+ */
156
+ export function buildVersionConfig(versionId, options = {}) {
157
+ const includeDemoAuthorization = !options.githubOwner && !options.githubRepo;
158
+ const menus = buildVersionMenus(versionId);
159
+
160
+ return {
161
+ auth: {
162
+ accessKeys: {
163
+ "docs-key": "open-gitpagedocs-docs",
164
+ },
165
+ rolesStorageKey: "git-page-docs:route-auth:roles",
166
+ providers: [
167
+ { type: "authjs", enabled: true, sessionEndpoint: "/api/auth/session", rolesClaimPath: "user.roles" },
168
+ { type: "clerk", enabled: true, rolesClaimPath: "claims.publicMetadata.roles" },
169
+ { type: "firebase", enabled: true, tokenStorageKey: "git-page-docs:firebase-token", rolesClaimPath: "roles" },
170
+ { type: "jwt", enabled: true, tokenStorageKey: "git-page-docs:jwt-token", rolesClaimPath: "roles" },
171
+ ],
172
+ },
173
+ "routes-md": buildVersionMdRoutes(versionId, includeDemoAuthorization),
174
+ "routes-source-viewer": buildVersionSourceViewerRoutes(options),
175
+ "routes-html": [],
176
+ "routes-video": buildVersionVideoRoutes(versionId, includeDemoAuthorization),
177
+ "routes-audio": buildVersionAudioRoutes(versionId),
178
+ "menus-header-md": menus.md,
179
+ "menus-header-source-viewer": menus.sourceViewer,
180
+ "menus-header-html": menus.html,
181
+ "menus-header-video": menus.video,
182
+ "menus-header-audio": menus.audio,
183
+ hierarchyPage: DEFAULT_HIERARCHY,
184
+ hierarchyMenu: DEFAULT_HIERARCHY,
185
+ };
186
+ }