@gitpagedocs/cli 1.1.62 → 1.1.64

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 (59) hide show
  1. package/README.md +193 -193
  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/ports/cli-runtime-ports.ts +91 -91
  16. package/application/report/config-only-reporter.mjs +64 -64
  17. package/application/use-cases/dispatch-mode.ts +18 -18
  18. package/builders/config-orchestrator.mjs +34 -34
  19. package/builders/project-links.mjs +50 -50
  20. package/builders/root-config-builder.mjs +61 -61
  21. package/builders/route-builders.mjs +136 -136
  22. package/builders/theme-template.mjs +76 -76
  23. package/builders/version-config-builder.mjs +186 -186
  24. package/content/docs-en.mjs +549 -549
  25. package/content/docs-es.mjs +462 -462
  26. package/content/docs-pt.mjs +462 -462
  27. package/contracts/doc-versions.mjs +3 -3
  28. package/data/default-site-config.mjs +321 -321
  29. package/data/i18n-langmenu.mjs +347 -347
  30. package/data/layouts.mjs +436 -436
  31. package/data/path-mappings.mjs +26 -26
  32. package/data/route-metas.mjs +93 -93
  33. package/data/theme-colors.mjs +443 -443
  34. package/data/urls.mjs +12 -12
  35. package/domain/models/cli-options.ts +33 -33
  36. package/home/constants.mjs +4 -4
  37. package/index.mjs +37 -37
  38. package/infrastructure/gitpagedocs-config-file.ts +47 -47
  39. package/infrastructure/home/runtime.mjs +37 -37
  40. package/package.json +3 -3
  41. package/presentation/commands/ai-info.ts +57 -57
  42. package/presentation/commands/config-clear.ts +23 -23
  43. package/presentation/commands/config-info.ts +24 -24
  44. package/presentation/commands/diagnostics.ts +164 -164
  45. package/presentation/commands/docs.ts +37 -37
  46. package/presentation/commands/mcp.ts +20 -20
  47. package/presentation/commands/pages.ts +101 -101
  48. package/presentation/commands/password.ts +62 -62
  49. package/presentation/commands/run-command.ts +70 -70
  50. package/presentation/index.ts +124 -124
  51. package/presentation/options/parser.ts +119 -119
  52. package/presentation/options/resolver.ts +46 -46
  53. package/presentation/ui/clack.ts +91 -91
  54. package/presentation/ui/prompts.ts +146 -146
  55. package/runtime/git-ops.mjs +110 -110
  56. package/runtime/output.mjs +159 -159
  57. package/runtime/workflow.mjs +129 -129
  58. package/start.mjs +12 -12
  59. 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
+ }