@dooc-dev/dooc 0.0.0-stage → 0.0.1

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 (213) hide show
  1. package/README.md +26 -2
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +244 -0
  4. package/dist/code.global.js +285 -0
  5. package/dist/compiler/bundle-urls.d.ts +3 -0
  6. package/dist/compiler/bundle-urls.js +294 -0
  7. package/dist/compiler/bundle.d.ts +2 -0
  8. package/dist/compiler/bundle.js +100 -0
  9. package/dist/compiler/check-prose.d.ts +11 -0
  10. package/dist/compiler/check-prose.js +138 -0
  11. package/dist/compiler/check-types.d.ts +44 -0
  12. package/dist/compiler/check-types.js +1 -0
  13. package/dist/compiler/check.d.ts +5 -0
  14. package/dist/compiler/check.js +450 -0
  15. package/dist/compiler/code-blocks.d.ts +17 -0
  16. package/dist/compiler/code-blocks.js +198 -0
  17. package/dist/compiler/code-languages.d.ts +10 -0
  18. package/dist/compiler/code-languages.js +109 -0
  19. package/dist/compiler/compile.d.ts +95 -0
  20. package/dist/compiler/compile.js +410 -0
  21. package/dist/compiler/config.d.ts +7 -0
  22. package/dist/compiler/config.js +52 -0
  23. package/dist/compiler/dialect.d.ts +24 -0
  24. package/dist/compiler/dialect.js +198 -0
  25. package/dist/compiler/drawio.d.ts +26 -0
  26. package/dist/compiler/drawio.js +176 -0
  27. package/dist/compiler/figures.d.ts +14 -0
  28. package/dist/compiler/figures.js +221 -0
  29. package/dist/compiler/file-cache.d.ts +14 -0
  30. package/dist/compiler/file-cache.js +61 -0
  31. package/dist/compiler/files.d.ts +29 -0
  32. package/dist/compiler/files.js +431 -0
  33. package/dist/compiler/fonts.d.ts +10 -0
  34. package/dist/compiler/fonts.js +54 -0
  35. package/dist/compiler/format.d.ts +1 -0
  36. package/dist/compiler/format.js +42 -0
  37. package/dist/compiler/from-mdast.d.ts +16 -0
  38. package/dist/compiler/from-mdast.js +142 -0
  39. package/dist/compiler/icons.d.ts +14 -0
  40. package/dist/compiler/icons.js +85 -0
  41. package/dist/compiler/language-codes.d.ts +7 -0
  42. package/dist/compiler/language-codes.js +17 -0
  43. package/dist/compiler/locales.d.ts +7 -0
  44. package/dist/compiler/locales.js +67 -0
  45. package/dist/compiler/manifest.d.ts +6 -0
  46. package/dist/compiler/manifest.js +30 -0
  47. package/dist/compiler/ops.d.ts +44 -0
  48. package/dist/compiler/ops.js +362 -0
  49. package/dist/compiler/public-file.d.ts +2 -0
  50. package/dist/compiler/public-file.js +93 -0
  51. package/dist/compiler/serialize.d.ts +3 -0
  52. package/dist/compiler/serialize.js +16 -0
  53. package/dist/compiler/terms.d.ts +9 -0
  54. package/dist/compiler/terms.js +44 -0
  55. package/dist/compiler/textfile-remote.d.ts +12 -0
  56. package/dist/compiler/textfile-remote.js +124 -0
  57. package/dist/compiler/textfile.d.ts +9 -0
  58. package/dist/compiler/textfile.js +113 -0
  59. package/dist/compiler/theme-variants.d.ts +4 -0
  60. package/dist/compiler/theme-variants.js +22 -0
  61. package/dist/compiler/zip.d.ts +6 -0
  62. package/dist/compiler/zip.js +48 -0
  63. package/dist/core/blocks.d.ts +99 -0
  64. package/dist/core/blocks.js +29 -0
  65. package/dist/core/code-file.d.ts +12 -0
  66. package/dist/core/code-file.js +68 -0
  67. package/dist/core/content-metadata.d.ts +48 -0
  68. package/dist/core/content-metadata.js +264 -0
  69. package/dist/core/content-types.d.ts +45 -0
  70. package/dist/core/content-types.js +1 -0
  71. package/dist/core/figure-frame.d.ts +12 -0
  72. package/dist/core/figure-frame.js +108 -0
  73. package/dist/core/file-embed.d.ts +13 -0
  74. package/dist/core/file-embed.js +43 -0
  75. package/dist/core/files.d.ts +15 -0
  76. package/dist/core/files.js +59 -0
  77. package/dist/core/flow-base-css.generated.d.ts +1 -0
  78. package/dist/core/flow-base-css.generated.js +4 -0
  79. package/dist/core/flow-css.d.ts +9 -0
  80. package/dist/core/flow-css.js +54 -0
  81. package/dist/core/graph-common.d.ts +32 -0
  82. package/dist/core/graph-common.js +113 -0
  83. package/dist/core/graph.d.ts +117 -0
  84. package/dist/core/graph.js +480 -0
  85. package/dist/core/html.d.ts +29 -0
  86. package/dist/core/html.js +444 -0
  87. package/dist/core/icons.d.ts +1 -0
  88. package/dist/core/icons.js +1 -0
  89. package/dist/core/inline.d.ts +27 -0
  90. package/dist/core/inline.js +42 -0
  91. package/dist/core/language.d.ts +41 -0
  92. package/dist/core/language.js +44 -0
  93. package/dist/core/languages/ja.d.ts +2 -0
  94. package/dist/core/languages/ja.js +5 -0
  95. package/dist/core/markdown.d.ts +27 -0
  96. package/dist/core/markdown.js +154 -0
  97. package/dist/core/previewers.d.ts +37 -0
  98. package/dist/core/previewers.js +103 -0
  99. package/dist/core/routing.d.ts +20 -0
  100. package/dist/core/routing.js +64 -0
  101. package/dist/core/schema-comments.d.ts +14 -0
  102. package/dist/core/schema-comments.js +52 -0
  103. package/dist/core/schema-graph-flow.d.ts +9 -0
  104. package/dist/core/schema-graph-flow.js +379 -0
  105. package/dist/core/schema-graph-mount.d.ts +9 -0
  106. package/dist/core/schema-graph-mount.js +105 -0
  107. package/dist/core/schema-graph.d.ts +254 -0
  108. package/dist/core/schema-graph.js +981 -0
  109. package/dist/core/table-ui.d.ts +2 -0
  110. package/dist/core/table-ui.js +180 -0
  111. package/dist/core/taxonomy.d.ts +12 -0
  112. package/dist/core/taxonomy.js +49 -0
  113. package/dist/core/term-reference.d.ts +5 -0
  114. package/dist/core/term-reference.js +19 -0
  115. package/dist/core/terms-ui.d.ts +6 -0
  116. package/dist/core/terms-ui.js +22 -0
  117. package/dist/core/textfile.d.ts +10 -0
  118. package/dist/core/textfile.js +39 -0
  119. package/dist/core/theme-variants.d.ts +3 -0
  120. package/dist/core/theme-variants.js +37 -0
  121. package/dist/core/toc-ui.d.ts +2 -0
  122. package/dist/core/toc-ui.js +161 -0
  123. package/dist/core/video-ui.d.ts +2 -0
  124. package/dist/core/video-ui.js +253 -0
  125. package/dist/core/workspace.d.ts +15 -0
  126. package/dist/core/workspace.js +28 -0
  127. package/dist/edit.global.js +305 -0
  128. package/dist/flow.global.js +4959 -0
  129. package/dist/index.d.ts +17 -0
  130. package/dist/index.js +31 -0
  131. package/dist/mcp.d.ts +24 -0
  132. package/dist/mcp.js +467 -0
  133. package/dist/plugins/actions.d.ts +45 -0
  134. package/dist/plugins/actions.js +125 -0
  135. package/dist/plugins/blocks.d.ts +92 -0
  136. package/dist/plugins/blocks.js +99 -0
  137. package/dist/plugins/index.d.ts +4 -0
  138. package/dist/plugins/index.js +1 -0
  139. package/dist/plugins/oauth.d.ts +14 -0
  140. package/dist/plugins/oauth.js +164 -0
  141. package/dist/plugins/runtime.d.ts +24 -0
  142. package/dist/plugins/runtime.js +339 -0
  143. package/dist/plugins/types.d.ts +56 -0
  144. package/dist/plugins/types.js +1 -0
  145. package/dist/plugins/view.d.ts +29 -0
  146. package/dist/plugins/view.js +60 -0
  147. package/dist/ui.global.js +77 -0
  148. package/dist/viewer/assets.d.ts +2 -0
  149. package/dist/viewer/assets.js +3 -0
  150. package/dist/viewer/build.d.ts +12 -0
  151. package/dist/viewer/build.js +55 -0
  152. package/dist/viewer/bundle-network.d.ts +2 -0
  153. package/dist/viewer/bundle-network.js +88 -0
  154. package/dist/viewer/code-file.d.ts +20 -0
  155. package/dist/viewer/code-file.js +42 -0
  156. package/dist/viewer/editor-tools.d.ts +38 -0
  157. package/dist/viewer/editor-tools.js +211 -0
  158. package/dist/viewer/file-references.d.ts +14 -0
  159. package/dist/viewer/file-references.js +38 -0
  160. package/dist/viewer/font-picker.d.ts +4 -0
  161. package/dist/viewer/font-picker.js +145 -0
  162. package/dist/viewer/font-settings.d.ts +11 -0
  163. package/dist/viewer/font-settings.js +50 -0
  164. package/dist/viewer/fonts/LICENSE.txt +119 -0
  165. package/dist/viewer/fonts/udev-gothic-regular.woff2 +0 -0
  166. package/dist/viewer/fonts.d.ts +2 -0
  167. package/dist/viewer/fonts.js +13 -0
  168. package/dist/viewer/git-diff.d.ts +3 -0
  169. package/dist/viewer/git-diff.js +33 -0
  170. package/dist/viewer/git-types.d.ts +73 -0
  171. package/dist/viewer/git-types.js +1 -0
  172. package/dist/viewer/git.d.ts +5 -0
  173. package/dist/viewer/git.js +337 -0
  174. package/dist/viewer/hmr.d.ts +53 -0
  175. package/dist/viewer/hmr.js +335 -0
  176. package/dist/viewer/i18n.d.ts +6 -0
  177. package/dist/viewer/i18n.js +65 -0
  178. package/dist/viewer/ja-lint.d.ts +3 -0
  179. package/dist/viewer/ja-lint.js +44 -0
  180. package/dist/viewer/language-picker.d.ts +2 -0
  181. package/dist/viewer/language-picker.js +233 -0
  182. package/dist/viewer/languages.d.ts +11 -0
  183. package/dist/viewer/languages.js +20 -0
  184. package/dist/viewer/locales/eng.json +294 -0
  185. package/dist/viewer/locales/jpn.json +294 -0
  186. package/dist/viewer/locales/zho.json +294 -0
  187. package/dist/viewer/nav-focus.d.ts +2 -0
  188. package/dist/viewer/nav-focus.js +64 -0
  189. package/dist/viewer/plugin-blocks.d.ts +3 -0
  190. package/dist/viewer/plugin-blocks.js +115 -0
  191. package/dist/viewer/plugin-config.d.ts +35 -0
  192. package/dist/viewer/plugin-config.js +57 -0
  193. package/dist/viewer/plugin-view.d.ts +3 -0
  194. package/dist/viewer/plugin-view.js +28 -0
  195. package/dist/viewer/plugins.d.ts +8 -0
  196. package/dist/viewer/plugins.js +214 -0
  197. package/dist/viewer/resize.d.ts +4 -0
  198. package/dist/viewer/resize.js +238 -0
  199. package/dist/viewer/resource-library.d.ts +29 -0
  200. package/dist/viewer/resource-library.js +104 -0
  201. package/dist/viewer/search.d.ts +16 -0
  202. package/dist/viewer/search.js +358 -0
  203. package/dist/viewer/serve.d.ts +206 -0
  204. package/dist/viewer/serve.js +3233 -0
  205. package/dist/viewer/site-icon.d.ts +8 -0
  206. package/dist/viewer/site-icon.js +56 -0
  207. package/dist/viewer/textfile.d.ts +9 -0
  208. package/dist/viewer/textfile.js +50 -0
  209. package/dist/viewer/theme-picker.d.ts +2 -0
  210. package/dist/viewer/theme-picker.js +135 -0
  211. package/dist/viewer/workspace.d.ts +4 -0
  212. package/dist/viewer/workspace.js +47 -0
  213. package/package.json +127 -5
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
- # Temporary Holding Version
1
+ # dooc
2
+ dooc is an orchestration tool for documentation.
3
+
4
+ 1. Create documentation resources.
5
+ 2. Build an interface for those resources.
6
+ 3. Distribute documentation everywhere.
7
+
8
+ # Usage
9
+ ```sh
10
+ pnpm exec dooc edit [root] [port] # open dooc in edit mode
11
+ pnpm exec dooc view [root] [port] # open dooc in view mode
12
+ pnpm exec dooc export zip [root] [out] # zip of the content (<root>/dist/<root name>.zip)
13
+ pnpm exec dooc export html [root] [out] # single HTML file with everything embedded (<root>/dist/index.html)
14
+ pnpm exec dooc mcp [root] # stdio MCP server (all read / write operations)
15
+ ```
16
+
17
+ Registering the MCP server (Claude Code):
18
+
19
+ ```sh
20
+ claude mcp add docs -- pnpm exec dooc mcp /path/to/root
21
+ ```
22
+
23
+ tool: `list_docs` `search_docs` `read_doc` `read_figure` `check` `add_doc` `write_doc` `move_doc` `rename_doc` `delete_doc` `add_figure` `delete_figure`
24
+
25
+ # Folder structure
26
+
2
27
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+ // CLI entry shared by npx and mise. Root defaults to cwd; relative paths resolve against cwd.
3
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
+ import { dirname, join, resolve } from "node:path";
5
+ import { parseArgs } from "node:util";
6
+ import { prebuilt } from "./viewer/assets.js";
7
+ process.env.NODE_ENV = prebuilt ? "production" : "development";
8
+ const USAGE = `usage: dooc <command>
9
+
10
+ edit [root] [port] open dooc in edit mode
11
+ view [root] [port] open dooc in view mode
12
+ --viewer-plugins <module> inject an external viewer plugin module
13
+ build html [root] [out-dir] build bundle.html (default <root>/dist)
14
+ build zip [root] [out-dir] build bundle.zip (default <root>/dist)
15
+ --url_preview embed|network URL handling for either format (default: embed)
16
+ check [root] [options] JSON consistency report (check --help for options)
17
+ font add <file> [root] register a font in the project (.dooc/fonts/)
18
+ font list [root] list registered project fonts
19
+ font remove <name> [root] remove a registered project font
20
+ mcp [root] stdio MCP server (all read / write operations)
21
+ --git-origin <module> inject gitOrigin from an external viewer plugin module
22
+ help, --help, -h show this help`;
23
+ const fail = (message) => {
24
+ console.error(message);
25
+ process.exit(1);
26
+ };
27
+ const docsRoot = (arg) => {
28
+ const root = resolve(arg ?? ".");
29
+ return existsSync(root) ? root : fail(`${root} does not exist`);
30
+ };
31
+ const writeOut = (out, data) => {
32
+ mkdirSync(dirname(out), { recursive: true });
33
+ writeFileSync(out, data);
34
+ };
35
+ const [command, ...args] = process.argv.slice(2);
36
+ switch (command) {
37
+ case "font": {
38
+ const { addProjectFont, listProjectFonts, removeProjectFont } = await import("./compiler/fonts.js");
39
+ try {
40
+ const { positionals, values } = parseArgs({
41
+ args,
42
+ allowPositionals: true,
43
+ options: { help: { type: "boolean", short: "h" } },
44
+ });
45
+ if (values.help) {
46
+ console.log("usage: dooc font add <file> [root] | list [root] | remove <name> [root]\n\nFonts are copied to <root>/.dooc/fonts/ and included in ZIP and HTML bundles.\nSupported formats: TTF, OTF, WOFF, WOFF2. Existing names are never overwritten.\nReload the viewer after changing registered fonts. Default root: current directory.");
47
+ break;
48
+ }
49
+ const [action, value, rootArg] = positionals;
50
+ if (action === "list" && positionals.length <= 2) {
51
+ console.log(JSON.stringify(listProjectFonts(docsRoot(value)), null, 2));
52
+ }
53
+ else if (action === "add" && value && positionals.length <= 3) {
54
+ console.log(addProjectFont(docsRoot(rootArg), resolve(value)));
55
+ }
56
+ else if (action === "remove" && value && positionals.length <= 3) {
57
+ removeProjectFont(docsRoot(rootArg), value);
58
+ console.log(`Removed font: ${value}`);
59
+ }
60
+ else
61
+ throw new Error("usage: dooc font add <file> [root] | list [root] | remove <name> [root]");
62
+ }
63
+ catch (error) {
64
+ fail(error instanceof Error ? error.message : String(error));
65
+ }
66
+ break;
67
+ }
68
+ case "check": {
69
+ const { checkSite } = await import("./compiler/check.js");
70
+ let report;
71
+ try {
72
+ const { positionals, values } = parseArgs({
73
+ args,
74
+ allowPositionals: true,
75
+ options: {
76
+ only: { type: "string", multiple: true },
77
+ "allow-shared-svg": { type: "boolean" },
78
+ "warnings-as-errors": { type: "boolean" },
79
+ help: { type: "boolean", short: "h" },
80
+ },
81
+ });
82
+ if (values.help) {
83
+ console.log(`usage: dooc check [root] [options]
84
+
85
+ --only render,languages,themes select checks (default: all three)
86
+ manifest validity is always checked
87
+ --allow-shared-svg allow identical SVG bytes across themes (missing variants still fail)
88
+ --warnings-as-errors fail on warnings as well as errors
89
+ --help, -h show this help
90
+
91
+ dooc.yaml example:
92
+ defaultLang: jpn
93
+ languages: [jpn, eng]
94
+ themes: [light, dark]
95
+
96
+ Translations: locales/<ISO 639-3>/<source path>.
97
+ Theme variants: themes/<theme>/<asset path>.
98
+ stdout: one JSON CheckReport with schemaVersion=1, checks, diagnostics, summary and exitCode.
99
+ render uses the viewer compiler; languages checks availability and prose; themes checks variants.
100
+ Site declarations determine the expected languages and themes, never CLI overrides.
101
+ Diagnostic codes, relative file paths, sourceFile, language, theme and one-based lines are
102
+ machine-readable; message text is for humans. Prose detection is heuristic and offline.
103
+ Short text, unsupported formats and remote content are reported as unchecked/inconclusive.
104
+ Exit codes: 0 passed; 1 errors (or warnings with --warnings-as-errors); 2 invocation/execution failure.
105
+ Node API: import { checkSite } from "@dooc-dev/dooc/check".`);
106
+ break;
107
+ }
108
+ if (positionals.length > 1)
109
+ throw new Error("check accepts at most one root path");
110
+ report = checkSite(resolve(positionals[0] ?? "."), {
111
+ ...(values.only
112
+ ? {
113
+ only: values.only.flatMap((value) => value.split(",")),
114
+ }
115
+ : {}),
116
+ allowSharedSvg: values["allow-shared-svg"],
117
+ warningsAsErrors: values["warnings-as-errors"],
118
+ });
119
+ }
120
+ catch (error) {
121
+ report = {
122
+ schemaVersion: 1,
123
+ root: resolve("."),
124
+ checks: [],
125
+ languages: [],
126
+ themes: [],
127
+ diagnostics: [
128
+ {
129
+ check: "config",
130
+ code: "INVOCATION_INVALID",
131
+ severity: "error",
132
+ file: ".",
133
+ message: error instanceof Error ? error.message : String(error),
134
+ },
135
+ ],
136
+ summary: { errors: 1, warnings: 0, info: 0 },
137
+ exitCode: 2,
138
+ };
139
+ }
140
+ console.log(JSON.stringify(report, null, 2));
141
+ process.exitCode = report.exitCode;
142
+ break;
143
+ }
144
+ case "view":
145
+ case "edit": {
146
+ const { positionals, values } = parseArgs({
147
+ args,
148
+ allowPositionals: true,
149
+ options: { "viewer-plugins": { type: "string" } },
150
+ });
151
+ process.env.DOCS_ROOT = docsRoot(positionals[0]);
152
+ process.env.DOCS_HMR = "1";
153
+ // serve.ts reads DOCS_ROOT at import time, so import it after the env is set.
154
+ const { startServer } = await import("./viewer/serve.js");
155
+ await startServer(command === "view" ? "preview" : "edit", Number(positionals[1] ?? 5179), values["viewer-plugins"] ?? process.env.DOOC_VIEWER_PLUGINS);
156
+ break;
157
+ }
158
+ case "build": {
159
+ try {
160
+ const { positionals, values } = parseArgs({
161
+ args,
162
+ allowPositionals: true,
163
+ options: {
164
+ url_preview: { type: "string", default: "embed" },
165
+ help: { type: "boolean", short: "h" },
166
+ },
167
+ });
168
+ if (values.help) {
169
+ console.log(`usage: dooc build html [root] [out-dir] [--url_preview embed|network]
170
+ dooc build zip [root] [out-dir] [--url_preview embed|network]
171
+
172
+ A bundle is dooc.yaml and its managed content. Builds only the selected format.
173
+ Default output directory: <root>/dist. Source files are never rewritten.
174
+ --url_preview embed snapshot URL content and assets into the selected artifact (default)
175
+ --url_preview network preserve URL references without downloading them at build time
176
+
177
+ HTML embed: no network when opened. HTML network: fetch URLs when opened (text requires CORS).
178
+ ZIP embed: save URL content and rewrite references. ZIP network: keep the original URLs.
179
+
180
+ Only embedded references such as ![](url) are downloaded; ordinary hyperlinks remain links.
181
+ Snapshots use public HTTPS without credentials or redirects. Static HTML captures the server's
182
+ HTML and declarative assets; it does not execute the source site's JavaScript or perform login.
183
+ Remote files are limited to 2 MiB each and 64 MiB / 256 assets total.
184
+ A failed download or invalid source stops the build before replacing the selected artifact.
185
+ Use --url_preview network with either format to build without downloading URL content.`);
186
+ break;
187
+ }
188
+ const [format, rootArg, outArg] = positionals;
189
+ if (format !== "html" && format !== "zip")
190
+ throw new Error("build format must be html | zip");
191
+ if (positionals.length > 3)
192
+ throw new Error(`build ${format} accepts a root and an output directory`);
193
+ const urlPreview = values.url_preview;
194
+ if (urlPreview !== "embed" && urlPreview !== "network")
195
+ throw new Error("--url_preview must be embed | network");
196
+ const root = docsRoot(rootArg);
197
+ const out = join(resolve(outArg ?? join(root, "dist")), `bundle.${format}`);
198
+ const { buildBundle } = await import("./viewer/build.js");
199
+ const bundle = await buildBundle(root, { format, urlPreview });
200
+ writeOut(out, bundle.data);
201
+ console.log(`${out} — ${bundle.docs} docs (url_preview=${urlPreview})`);
202
+ }
203
+ catch (error) {
204
+ fail(error instanceof Error ? error.message : String(error));
205
+ }
206
+ break;
207
+ }
208
+ case "mcp": {
209
+ try {
210
+ const { positionals, values } = parseArgs({
211
+ args,
212
+ allowPositionals: true,
213
+ options: {
214
+ "git-origin": { type: "string" },
215
+ help: { type: "boolean", short: "h" },
216
+ },
217
+ });
218
+ if (values.help) {
219
+ console.log("usage: dooc mcp [root] [--git-origin <module>]\n\nExposes docs, files, Statics, fonts, check, build and Git over stdio.\nBuild accepts format=html|zip and url_preview=embed|network (default embed).\nThe external module's default export must contain gitOrigin (the same provider used by edit/view).\nOnly gitOrigin is used; viewer setup and data plugins are not started. Authentication stays in the provider.");
220
+ break;
221
+ }
222
+ if (positionals.length > 1)
223
+ throw new Error("mcp accepts at most one root path");
224
+ const { startMcp } = await import("./mcp.js");
225
+ const { loadViewerPlugins } = await import("./viewer/plugin-config.js");
226
+ const { gitOrigin } = await loadViewerPlugins(values["git-origin"]);
227
+ if (values["git-origin"] && !gitOrigin)
228
+ throw new Error("Module must provide gitOrigin");
229
+ await startMcp(docsRoot(positionals[0]), { gitOrigin });
230
+ }
231
+ catch (error) {
232
+ fail(error instanceof Error ? error.message : String(error));
233
+ }
234
+ break;
235
+ }
236
+ case undefined:
237
+ case "help":
238
+ case "--help":
239
+ case "-h":
240
+ console.log(USAGE);
241
+ break;
242
+ default:
243
+ fail(`unknown command: ${command}\n\n${USAGE}`);
244
+ }