sourcey 3.5.1 → 3.5.2
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 +90 -10
- package/dist/cli.js +122 -3
- package/dist/components/layout/Page.d.ts.map +1 -1
- package/dist/components/layout/Page.js +4 -1
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -3
- package/dist/core/godoc-introspector.d.ts +26 -0
- package/dist/core/godoc-introspector.d.ts.map +1 -0
- package/dist/core/godoc-introspector.js +144 -0
- package/dist/core/godoc-loader.d.ts +34 -0
- package/dist/core/godoc-loader.d.ts.map +1 -0
- package/dist/core/godoc-loader.js +491 -0
- package/dist/core/godoc-types.d.ts +109 -0
- package/dist/core/godoc-types.d.ts.map +1 -0
- package/dist/core/godoc-types.js +8 -0
- package/dist/core/markdown-loader.d.ts +10 -0
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/search-indexer.d.ts.map +1 -1
- package/dist/core/search-indexer.js +9 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/main.go +736 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site.go +497 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site_test.go +89 -0
- package/dist/core/sourcey-godoc/doc.go +11 -0
- package/dist/core/sourcey-godoc/go.mod +3 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +42 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/site-assembly.d.ts +3 -0
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +30 -1
- package/dist/themes/default/sourcey.css +244 -0
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> Your API docs shouldn't depend on someone else's SaaS.
|
|
4
4
|
|
|
5
|
-
Sourcey is an open source documentation platform. Point it at an OpenAPI spec, an MCP server,
|
|
5
|
+
Sourcey is an open source documentation platform. Point it at an OpenAPI spec, an MCP server, a Doxygen XML directory, or a Go module; add markdown guides; get a complete docs site. Static HTML you own; no dashboard, no monthly bill, no API calls to render your own documentation. Deploy anywhere.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/sourcey)
|
|
8
|
-
[](https://github.com/sourcey/sourcey/actions)
|
|
9
9
|
[](https://nodejs.org)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://pkg.go.dev/github.com/sourcey/sourcey/go/sourcey-godoc)
|
|
12
|
+
[](https://goreportcard.com/report/github.com/sourcey/sourcey/go/sourcey-godoc)
|
|
10
13
|
|
|
11
14
|
```bash
|
|
12
15
|
npx sourcey init
|
|
@@ -23,6 +26,7 @@ npx sourcey init
|
|
|
23
26
|
- **MCP server documentation**: tools, resources, prompts rendered as browsable reference with JSON-RPC, TypeScript, and Python code samples. Color-coded method types, annotation badges, connection config cards
|
|
24
27
|
- **Markdown guides with rich components**: steps, cards, accordions, syntax-highlighted code blocks; prose docs alongside your API reference
|
|
25
28
|
- **C++ and Doxygen**: feed Doxygen XML output, get modern searchable API docs. No new parser, no four-tool Breathe/Exhale/Sphinx pipeline
|
|
29
|
+
- **Go and godoc**: native package documentation extracted from Go source via the toolchain. Render Go modules as Sourcey tabs, generate standalone static Go docs sites, or commit `godoc.json` snapshots for JS-only docs hosts. No Doxygen detour
|
|
26
30
|
- **llms.txt generation**: auto-generate llms.txt and llms-full.txt alongside your HTML. Docs serve developers and AI agents from one build
|
|
27
31
|
- **TypeScript config**: `sourcey.config.ts` with `defineConfig()` autocomplete; theme, navbar, CTA buttons, footer
|
|
28
32
|
- **Theme presets**: default (sidebar + TOC), minimal (single column), api-first (Stripe-style three column); colors, fonts, layout dimensions, and custom CSS on top
|
|
@@ -32,6 +36,15 @@ npx sourcey init
|
|
|
32
36
|
- **Static HTML output**: no framework runtime, no vendor lock-in. Deploy to GitHub Pages, Vercel, Netlify, S3, anywhere
|
|
33
37
|
- **Open source**: AGPL-3.0. Self-host, fork, extend. Your docs, your infrastructure
|
|
34
38
|
|
|
39
|
+
## OSS and Sourcey Cloud
|
|
40
|
+
|
|
41
|
+
This repository is the public, local-first Sourcey product. Sourcey Cloud
|
|
42
|
+
features that require hosted infrastructure, such as OAuth callbacks, CORS
|
|
43
|
+
proxying, secret vaulting, hosted analytics, billing, and tenant control-plane
|
|
44
|
+
APIs, are not implemented in this OSS package. When OSS features need a hosted
|
|
45
|
+
runtime, they expose documented provider-neutral extension points instead of
|
|
46
|
+
private Sourcey Cloud client code.
|
|
47
|
+
|
|
35
48
|
### Sourcey vs alternatives
|
|
36
49
|
|
|
37
50
|
| | Sourcey | Redocly | GitBook | Mintlify | Fern | ReadMe |
|
|
@@ -41,6 +54,7 @@ npx sourcey init
|
|
|
41
54
|
| Zero JS shipped | Yes | No | No | No | No | No |
|
|
42
55
|
| MCP server docs | Native | No | No | No | No | No |
|
|
43
56
|
| Doxygen / C++ docs | Native | No | No | No | No | No |
|
|
57
|
+
| godoc / Go docs | Native | No | No | No | No | No |
|
|
44
58
|
| Config format | TypeScript | YAML | GUI | JSON | YAML | GUI |
|
|
45
59
|
| Local preview | Vite SSR | Local | Cloud | Local | Local | Cloud |
|
|
46
60
|
| No account required | Yes | Partial | No | No | No | No |
|
|
@@ -49,18 +63,31 @@ npx sourcey init
|
|
|
49
63
|
|
|
50
64
|
## Install
|
|
51
65
|
|
|
66
|
+
### Sourcey
|
|
67
|
+
|
|
52
68
|
```bash
|
|
53
|
-
|
|
69
|
+
npm install -g sourcey
|
|
54
70
|
npx sourcey init
|
|
71
|
+
```
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
brew tap sourcey/sourcey && brew install sourcey
|
|
73
|
+
### Go docs generator
|
|
58
74
|
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
```bash
|
|
76
|
+
go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Homebrew
|
|
61
80
|
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
```bash
|
|
82
|
+
brew tap sourcey/tap
|
|
83
|
+
brew install sourcey-godoc
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Scoop
|
|
87
|
+
|
|
88
|
+
```powershell
|
|
89
|
+
scoop bucket add sourcey https://github.com/sourcey/scoop-bucket
|
|
90
|
+
scoop install sourcey-godoc
|
|
64
91
|
```
|
|
65
92
|
|
|
66
93
|
## Quick start
|
|
@@ -125,7 +152,57 @@ export default defineConfig({
|
|
|
125
152
|
});
|
|
126
153
|
```
|
|
127
154
|
|
|
128
|
-
Each tab is an `openapi` spec, an `mcp` snapshot, a `doxygen` directory, or `groups` of markdown pages. Pages are referenced by slug (e.g. `"quickstart"` resolves to `quickstart.md`).
|
|
155
|
+
Each tab is an `openapi` spec, an `mcp` snapshot, a `doxygen` directory, a `godoc` Go module, or `groups` of markdown pages. Pages are referenced by slug (e.g. `"quickstart"` resolves to `quickstart.md`).
|
|
156
|
+
|
|
157
|
+
### Go documentation (godoc)
|
|
158
|
+
|
|
159
|
+
Add a Go module as a tab and Sourcey extracts package docs natively (no Doxygen pipeline):
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
{
|
|
163
|
+
tab: "Go API",
|
|
164
|
+
godoc: {
|
|
165
|
+
module: ".",
|
|
166
|
+
packages: ["./internal/core/...", "./cmd/..."],
|
|
167
|
+
// sourceBasePath: "go/my-module" // repo-relative prefix for source links when module is not at repo root
|
|
168
|
+
// mode: "auto" // default; live when Go is available, snapshot otherwise
|
|
169
|
+
// includeTests: true // examples from *_test.go (default)
|
|
170
|
+
// includeUnexported: false // hide unexported symbols (default)
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The string shorthand is `godoc: "."` and expands to `{ module: ".", packages: ["./..."], mode: "auto", includeTests: true }`.
|
|
176
|
+
|
|
177
|
+
`editBasePath` remains the global base for Markdown "Edit this page" links.
|
|
178
|
+
Use `godoc.sourceBasePath` only when Go source files live under a different
|
|
179
|
+
repository prefix than the docs source.
|
|
180
|
+
|
|
181
|
+
Live mode invokes `go list` + `go/parser` + `go/doc` against the host Go toolchain. To pin a build environment for reproducibility, set `goEnv: { GOOS, GOARCH, tags }`.
|
|
182
|
+
|
|
183
|
+
Snapshot mode reads a committed `godoc.json` and needs no Go on the build host. Generate it with:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
sourcey godoc --module . --packages './...' --out docs/godoc.json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
then point the tab at it:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
{
|
|
193
|
+
tab: "Go API",
|
|
194
|
+
godoc: { mode: "snapshot", snapshot: "./docs/godoc.json" },
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The extractor is also a standalone Go CLI for projects that want a native Go
|
|
199
|
+
docs generator without installing the full Sourcey npm package:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest
|
|
203
|
+
sourcey-godoc generate --module . --packages './...' --out site
|
|
204
|
+
sourcey-godoc snapshot --module . --packages './...' --out docs/godoc.json
|
|
205
|
+
```
|
|
129
206
|
|
|
130
207
|
### Markdown components
|
|
131
208
|
|
|
@@ -171,6 +248,8 @@ sourcey dev Dev server (reads sourcey.config.ts)
|
|
|
171
248
|
sourcey build Build site (reads sourcey.config.ts)
|
|
172
249
|
sourcey build api.yaml Quick build from a single spec
|
|
173
250
|
sourcey validate api.yaml Validate a spec file
|
|
251
|
+
sourcey godoc --out godoc.json Snapshot a Go module's docs to JSON
|
|
252
|
+
sourcey-godoc generate --out site Standalone Go CLI for static godoc sites
|
|
174
253
|
```
|
|
175
254
|
|
|
176
255
|
| Command | Flag | Description |
|
|
@@ -186,6 +265,7 @@ sourcey validate api.yaml Validate a spec file
|
|
|
186
265
|
git clone https://github.com/sourcey/sourcey.git
|
|
187
266
|
cd sourcey && npm install
|
|
188
267
|
npm run build && npm test
|
|
268
|
+
cd go/sourcey-godoc && go test ./... && go vet ./...
|
|
189
269
|
|
|
190
270
|
# Run the demo site
|
|
191
271
|
cd demo && npx tsx ../src/cli.ts dev
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
3
5
|
import { buildDocs, buildSiteDocs } from "./index.js";
|
|
4
6
|
import { loadConfig } from "./config.js";
|
|
7
|
+
import { runIntrospector, GodocIntrospectorError } from "./core/godoc-introspector.js";
|
|
8
|
+
import { GODOC_SCHEMA_VERSION } from "./core/godoc-types.js";
|
|
5
9
|
import { init } from "./init.js";
|
|
6
|
-
import { formatChangelogDiagnostic } from "./site-assembly.js";
|
|
10
|
+
import { formatChangelogDiagnostic, formatGodocDiagnostic } from "./site-assembly.js";
|
|
7
11
|
import pkg from "../package.json" with { type: "json" };
|
|
8
12
|
const build = defineCommand({
|
|
9
13
|
meta: {
|
|
@@ -79,6 +83,7 @@ const build = defineCommand({
|
|
|
79
83
|
});
|
|
80
84
|
if (!args.quiet) {
|
|
81
85
|
logChangelogDiagnostics(result.changelogDiagnostics);
|
|
86
|
+
logGodocDiagnostics(result.godocDiagnostics);
|
|
82
87
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
83
88
|
console.log(` Pages: ${result.pageCount}`);
|
|
84
89
|
console.log(` Output: ${result.outputDir}`);
|
|
@@ -155,17 +160,121 @@ const validate = defineCommand({
|
|
|
155
160
|
}
|
|
156
161
|
},
|
|
157
162
|
});
|
|
163
|
+
const godoc = defineCommand({
|
|
164
|
+
meta: {
|
|
165
|
+
name: "godoc",
|
|
166
|
+
description: "Snapshot a Go module's godoc data into a portable JSON file",
|
|
167
|
+
},
|
|
168
|
+
args: {
|
|
169
|
+
module: {
|
|
170
|
+
type: "string",
|
|
171
|
+
alias: ["m"],
|
|
172
|
+
description: "Go module directory (containing go.mod)",
|
|
173
|
+
default: ".",
|
|
174
|
+
},
|
|
175
|
+
packages: {
|
|
176
|
+
type: "string",
|
|
177
|
+
alias: ["p"],
|
|
178
|
+
description: "Package patterns (comma-separated)",
|
|
179
|
+
default: "./...",
|
|
180
|
+
},
|
|
181
|
+
exclude: {
|
|
182
|
+
type: "string",
|
|
183
|
+
description: "Import-path prefixes to exclude (comma-separated)",
|
|
184
|
+
required: false,
|
|
185
|
+
},
|
|
186
|
+
out: {
|
|
187
|
+
type: "string",
|
|
188
|
+
alias: ["o"],
|
|
189
|
+
description: "Output file path",
|
|
190
|
+
default: "godoc.json",
|
|
191
|
+
},
|
|
192
|
+
includeTests: {
|
|
193
|
+
type: "boolean",
|
|
194
|
+
description: "Include examples from *_test.go files",
|
|
195
|
+
default: true,
|
|
196
|
+
},
|
|
197
|
+
includeUnexported: {
|
|
198
|
+
type: "boolean",
|
|
199
|
+
description: "Include unexported symbols",
|
|
200
|
+
default: false,
|
|
201
|
+
},
|
|
202
|
+
quiet: {
|
|
203
|
+
type: "boolean",
|
|
204
|
+
alias: ["q"],
|
|
205
|
+
description: "Suppress output",
|
|
206
|
+
default: false,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
async run({ args }) {
|
|
210
|
+
const moduleDir = resolve(process.cwd(), args.module);
|
|
211
|
+
const patterns = args.packages.split(",").map((p) => p.trim()).filter(Boolean);
|
|
212
|
+
const exclude = args.exclude
|
|
213
|
+
? args.exclude.split(",").map((p) => p.trim()).filter(Boolean)
|
|
214
|
+
: [];
|
|
215
|
+
const outputPath = resolve(process.cwd(), args.out);
|
|
216
|
+
try {
|
|
217
|
+
const spec = await runIntrospector({
|
|
218
|
+
config: {
|
|
219
|
+
module: moduleDir,
|
|
220
|
+
packages: patterns.length > 0 ? patterns : ["./..."],
|
|
221
|
+
mode: "live",
|
|
222
|
+
includeTests: args.includeTests,
|
|
223
|
+
includeUnexported: args.includeUnexported,
|
|
224
|
+
hideUndocumented: false,
|
|
225
|
+
exclude,
|
|
226
|
+
sourceBasePath: "",
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
const snapshot = {
|
|
230
|
+
schema_version: GODOC_SCHEMA_VERSION,
|
|
231
|
+
source: "sourcey-godoc",
|
|
232
|
+
module_path: spec.modulePath,
|
|
233
|
+
generated_at: spec.generatedAt,
|
|
234
|
+
packages: spec.packages,
|
|
235
|
+
diagnostics: spec.diagnostics.length > 0 ? spec.diagnostics : undefined,
|
|
236
|
+
};
|
|
237
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
238
|
+
await writeFile(outputPath, JSON.stringify(snapshot, null, 2) + "\n", "utf8");
|
|
239
|
+
const errors = spec.diagnostics.filter((d) => d.severity === "error");
|
|
240
|
+
const warnings = spec.diagnostics.filter((d) => d.severity === "warning");
|
|
241
|
+
if (!args.quiet) {
|
|
242
|
+
console.log(`\nSourcey: wrote godoc snapshot for ${spec.modulePath}`);
|
|
243
|
+
console.log(` Packages: ${spec.packages.length}`);
|
|
244
|
+
console.log(` Output: ${outputPath}`);
|
|
245
|
+
if (warnings.length > 0)
|
|
246
|
+
console.log(` Warnings: ${warnings.length}`);
|
|
247
|
+
if (errors.length > 0)
|
|
248
|
+
console.log(` Errors: ${errors.length}`);
|
|
249
|
+
for (const diag of spec.diagnostics) {
|
|
250
|
+
const where = diag.package ? ` [${diag.package}]` : "";
|
|
251
|
+
console.log(` ${diag.severity}: ${diag.code}${where} ${diag.message}`);
|
|
252
|
+
}
|
|
253
|
+
console.log("");
|
|
254
|
+
}
|
|
255
|
+
if (errors.length > 0)
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
260
|
+
const code = error instanceof GodocIntrospectorError ? ` (${error.code})` : "";
|
|
261
|
+
console.error(`\nError${code}: ${message}\n`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
});
|
|
158
266
|
const main = defineCommand({
|
|
159
267
|
meta: {
|
|
160
268
|
name: "sourcey",
|
|
161
269
|
version: pkg.version,
|
|
162
|
-
description: "Open source documentation platform for OpenAPI
|
|
270
|
+
description: "Open source documentation platform for OpenAPI, MCP, Doxygen, godoc, and Markdown",
|
|
163
271
|
},
|
|
164
272
|
subCommands: {
|
|
165
273
|
init,
|
|
166
274
|
build,
|
|
167
275
|
dev,
|
|
168
276
|
validate,
|
|
277
|
+
godoc,
|
|
169
278
|
},
|
|
170
279
|
args: {
|
|
171
280
|
spec: {
|
|
@@ -175,7 +284,11 @@ const main = defineCommand({
|
|
|
175
284
|
},
|
|
176
285
|
},
|
|
177
286
|
async run({ args, rawArgs }) {
|
|
178
|
-
if (rawArgs.includes("init") ||
|
|
287
|
+
if (rawArgs.includes("init") ||
|
|
288
|
+
rawArgs.includes("build") ||
|
|
289
|
+
rawArgs.includes("dev") ||
|
|
290
|
+
rawArgs.includes("validate") ||
|
|
291
|
+
rawArgs.includes("godoc"))
|
|
179
292
|
return;
|
|
180
293
|
if (args.spec) {
|
|
181
294
|
await build.run({
|
|
@@ -199,4 +312,10 @@ function logChangelogDiagnostics(diagnostics) {
|
|
|
199
312
|
console.log(` ${formatChangelogDiagnostic(diagnostic)}`);
|
|
200
313
|
}
|
|
201
314
|
}
|
|
315
|
+
function logGodocDiagnostics(diagnostics) {
|
|
316
|
+
for (const diagnostic of diagnostics) {
|
|
317
|
+
const writer = diagnostic.severity === "error" ? console.error : console.log;
|
|
318
|
+
writer(` ${formatGodocDiagnostic(diagnostic)}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
202
321
|
runMain(main);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Page.tsx"],"names":[],"mappings":"AAuRA,wBAAgB,IAAI,iCAqCnB"}
|
|
@@ -68,7 +68,10 @@ function ContentFooter() {
|
|
|
68
68
|
: undefined;
|
|
69
69
|
if (site.repo && site.editBranch && editPath) {
|
|
70
70
|
const repoBase = site.repo.replace(/\/$/, "");
|
|
71
|
-
const
|
|
71
|
+
const editBasePath = page.kind === "markdown" && page.markdown.editBasePath !== undefined
|
|
72
|
+
? page.markdown.editBasePath
|
|
73
|
+
: site.editBasePath;
|
|
74
|
+
const basePath = editBasePath ? `${editBasePath.replace(/^\/|\/$/g, "")}/` : "";
|
|
72
75
|
editUrl = `${repoBase}/edit/${site.editBranch}/${basePath}${editPath}`;
|
|
73
76
|
}
|
|
74
77
|
const linkStyle = "hover:text-[rgb(var(--color-gray-600))] dark:hover:text-[rgb(var(--color-gray-300))] transition-colors";
|
package/dist/config.d.ts
CHANGED
|
@@ -105,6 +105,45 @@ export interface DoxygenConfig {
|
|
|
105
105
|
*/
|
|
106
106
|
index?: DoxygenIndexStyle | false;
|
|
107
107
|
}
|
|
108
|
+
export type GodocMode = "auto" | "live" | "snapshot";
|
|
109
|
+
export interface GodocGoEnv {
|
|
110
|
+
GOOS?: string;
|
|
111
|
+
GOARCH?: string;
|
|
112
|
+
tags?: string[];
|
|
113
|
+
}
|
|
114
|
+
export interface GodocConfig {
|
|
115
|
+
/** Module root (directory containing go.mod). Defaults to the directory containing sourcey.config.ts. */
|
|
116
|
+
module?: string;
|
|
117
|
+
/** Package patterns passed to `go list`, e.g. "./..." or "./internal/core/...". */
|
|
118
|
+
packages?: string[];
|
|
119
|
+
/** Optional path to a committed godoc snapshot (godoc.json). */
|
|
120
|
+
snapshot?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Source mode.
|
|
123
|
+
* - "live": run the Go toolchain at build time.
|
|
124
|
+
* - "snapshot": read the committed snapshot file; no Go required.
|
|
125
|
+
* - "auto" (default): prefer live when Go is available; fall back to snapshot.
|
|
126
|
+
*/
|
|
127
|
+
mode?: GodocMode;
|
|
128
|
+
/** Include package examples from *_test.go files (default: true). */
|
|
129
|
+
includeTests?: boolean;
|
|
130
|
+
/** Include unexported symbols (default: false). */
|
|
131
|
+
includeUnexported?: boolean;
|
|
132
|
+
/** Hide packages with no package comment from navigation (default: false). */
|
|
133
|
+
hideUndocumented?: boolean;
|
|
134
|
+
/** Package path prefixes to exclude after `go list` expansion. */
|
|
135
|
+
exclude?: string[];
|
|
136
|
+
/**
|
|
137
|
+
* Pin Go build environment for reproducible live-mode docs across hosts.
|
|
138
|
+
* When unset, live mode follows the host's GOOS/GOARCH and active tags.
|
|
139
|
+
*/
|
|
140
|
+
goEnv?: GodocGoEnv;
|
|
141
|
+
/**
|
|
142
|
+
* Repository-relative base path for Go source links. Leave empty when the
|
|
143
|
+
* configured Go module is at the repository root.
|
|
144
|
+
*/
|
|
145
|
+
sourceBasePath?: string;
|
|
146
|
+
}
|
|
108
147
|
export interface TabConfig {
|
|
109
148
|
tab: string;
|
|
110
149
|
/** Custom URL slug for this tab. Defaults to slugified tab name. */
|
|
@@ -114,6 +153,11 @@ export interface TabConfig {
|
|
|
114
153
|
doxygen?: DoxygenConfig;
|
|
115
154
|
/** Path to an mcp.json file (MCP server snapshot). */
|
|
116
155
|
mcp?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Native Go documentation. String shorthand expands to
|
|
158
|
+
* `{ module: <value>, packages: ["./..."], mode: "auto", includeTests: true }`.
|
|
159
|
+
*/
|
|
160
|
+
godoc?: GodocConfig | string;
|
|
117
161
|
}
|
|
118
162
|
export interface GroupConfig {
|
|
119
163
|
group: string;
|
|
@@ -194,6 +238,21 @@ export interface ResolvedDoxygenConfig {
|
|
|
194
238
|
groups: boolean;
|
|
195
239
|
index: DoxygenIndexStyle;
|
|
196
240
|
}
|
|
241
|
+
export interface ResolvedGodocConfig {
|
|
242
|
+
/** Absolute path to the Go module directory (containing go.mod). */
|
|
243
|
+
module: string;
|
|
244
|
+
/** Package patterns to pass to `go list`. Always at least one entry. */
|
|
245
|
+
packages: string[];
|
|
246
|
+
/** Absolute path to a snapshot file when configured. */
|
|
247
|
+
snapshot?: string;
|
|
248
|
+
mode: GodocMode;
|
|
249
|
+
includeTests: boolean;
|
|
250
|
+
includeUnexported: boolean;
|
|
251
|
+
hideUndocumented: boolean;
|
|
252
|
+
exclude: string[];
|
|
253
|
+
goEnv?: GodocGoEnv;
|
|
254
|
+
sourceBasePath: string;
|
|
255
|
+
}
|
|
197
256
|
export interface ResolvedTab {
|
|
198
257
|
label: string;
|
|
199
258
|
slug: string;
|
|
@@ -201,6 +260,7 @@ export interface ResolvedTab {
|
|
|
201
260
|
groups?: ResolvedGroup[];
|
|
202
261
|
doxygen?: ResolvedDoxygenConfig;
|
|
203
262
|
mcp?: string;
|
|
263
|
+
godoc?: ResolvedGodocConfig;
|
|
204
264
|
}
|
|
205
265
|
export interface ResolvedPage {
|
|
206
266
|
/** Original config slug (e.g. "run/index") */
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAMhD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;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168,12 @@ async function resolveTabs(tabs, configDir) {
|
|
|
168
168
|
if (slugs.has(slug))
|
|
169
169
|
throw new Error(`Duplicate tab slug "${slug}" (from "${tab.tab}")`);
|
|
170
170
|
slugs.add(slug);
|
|
171
|
-
const sources = [tab.openapi, tab.groups, tab.doxygen, tab.mcp].filter(Boolean).length;
|
|
171
|
+
const sources = [tab.openapi, tab.groups, tab.doxygen, tab.mcp, tab.godoc].filter(Boolean).length;
|
|
172
172
|
if (sources > 1) {
|
|
173
|
-
throw new Error(`Tab "${tab.tab}" has multiple sources; use only one of "openapi", "groups", "doxygen", or "
|
|
173
|
+
throw new Error(`Tab "${tab.tab}" has multiple sources; use only one of "openapi", "groups", "doxygen", "mcp", or "godoc"`);
|
|
174
174
|
}
|
|
175
175
|
if (sources === 0) {
|
|
176
|
-
throw new Error(`Tab "${tab.tab}" needs one of "openapi", "groups", "doxygen", or "
|
|
176
|
+
throw new Error(`Tab "${tab.tab}" needs one of "openapi", "groups", "doxygen", "mcp", or "godoc"`);
|
|
177
177
|
}
|
|
178
178
|
if (tab.openapi) {
|
|
179
179
|
if (isUrl(tab.openapi)) {
|
|
@@ -209,6 +209,28 @@ async function resolveTabs(tabs, configDir) {
|
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
+
else if (tab.godoc) {
|
|
213
|
+
const cfg = typeof tab.godoc === "string" ? { module: tab.godoc } : tab.godoc;
|
|
214
|
+
const moduleAbs = resolve(configDir, cfg.module ?? ".");
|
|
215
|
+
await assertExists(moduleAbs, `Go module directory "${cfg.module ?? "."}" in tab "${tab.tab}"`);
|
|
216
|
+
const snapshotAbs = cfg.snapshot ? resolve(configDir, cfg.snapshot) : undefined;
|
|
217
|
+
resolved.push({
|
|
218
|
+
label: tab.tab,
|
|
219
|
+
slug,
|
|
220
|
+
godoc: {
|
|
221
|
+
module: moduleAbs,
|
|
222
|
+
packages: cfg.packages?.length ? cfg.packages : ["./..."],
|
|
223
|
+
snapshot: snapshotAbs,
|
|
224
|
+
mode: cfg.mode ?? "auto",
|
|
225
|
+
includeTests: cfg.includeTests ?? true,
|
|
226
|
+
includeUnexported: cfg.includeUnexported ?? false,
|
|
227
|
+
hideUndocumented: cfg.hideUndocumented ?? false,
|
|
228
|
+
exclude: cfg.exclude ?? [],
|
|
229
|
+
goEnv: cfg.goEnv,
|
|
230
|
+
sourceBasePath: trimSlashes(cfg.sourceBasePath ?? ""),
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
}
|
|
212
234
|
else {
|
|
213
235
|
const groups = await resolveGroups(tab.groups, tab.tab, configDir);
|
|
214
236
|
resolved.push({ label: tab.tab, slug, groups });
|
|
@@ -325,6 +347,9 @@ export function hexToRgb(hex) {
|
|
|
325
347
|
const b = parseInt(h.slice(4, 6), 16);
|
|
326
348
|
return `${r} ${g} ${b}`;
|
|
327
349
|
}
|
|
350
|
+
function trimSlashes(path) {
|
|
351
|
+
return path.replace(/^\/+|\/+$/g, "");
|
|
352
|
+
}
|
|
328
353
|
async function assertExists(filePath, label) {
|
|
329
354
|
try {
|
|
330
355
|
await access(filePath);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResolvedGodocConfig } from "../config.js";
|
|
2
|
+
import type { GodocSpec } from "./godoc-types.js";
|
|
3
|
+
export declare class GodocIntrospectorError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
readonly cause?: Error | undefined;
|
|
6
|
+
constructor(code: string, message: string, cause?: Error);
|
|
7
|
+
}
|
|
8
|
+
export interface IntrospectOptions {
|
|
9
|
+
config: ResolvedGodocConfig;
|
|
10
|
+
/** Override the Go executable; defaults to "go" on PATH. */
|
|
11
|
+
goBinary?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Run the Go introspector and return a parsed GodocSpec.
|
|
15
|
+
*
|
|
16
|
+
* Live mode invokes `go run` against the bundled helper, with `GOOS`/`GOARCH`
|
|
17
|
+
* and build tags pinned by `goEnv` when configured. Throws a structured
|
|
18
|
+
* `GodocIntrospectorError` on failure so callers can surface the right
|
|
19
|
+
* diagnostic kind.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runIntrospector(opts: IntrospectOptions): Promise<GodocSpec>;
|
|
22
|
+
/** Helper entry paths, exported for tests that pin the runtime. */
|
|
23
|
+
export declare const __helperEntryCandidatesForTests: string[];
|
|
24
|
+
/** Resolve the helper entry path relative to a given module directory. */
|
|
25
|
+
export declare function resolveHelperPath(fromDir: string): string;
|
|
26
|
+
//# sourceMappingURL=godoc-introspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"godoc-introspector.d.ts","sourceRoot":"","sources":["../../src/core/godoc-introspector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQjE,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;gBACvB,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAMzD;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgDjF;AAwGD,mEAAmE;AACnE,eAAO,MAAM,+BAA+B,UAG3C,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|