Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .claude/skills/nemo-curator-docs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,12 @@ This is a temporary maneuver — track the change so it gets reverted.

## Library Reference (Autodocs) and the Fern Cross-Ref Bug

`fern/docs.yml` declares a `libraries:` block that pulls Python source from `nemo_curator/` and generates MDX into `fern/product-docs/nemo-curator/Full-Library-Reference/` (gitignored). It runs as `fern docs md generate` in the publish and preview workflows.
`fern/docs.yml` declares two `libraries:` entries that write to the same output folder (`fern/product-docs/nemo-curator/Full-Library-Reference/`, gitignored):

- **`nemo-curator`** (`input.git`) — used by CI/publish/preview; requires `fern login` or `FERN_TOKEN`. Workflows run `fern docs md generate --library nemo-curator`.
- **`nemo-curator-local`** (`input.path: ../nemo_curator`) — local dev without Fern auth; requires Docker. Run `npm run generate:library:local` from `fern/`.

For a full API reference locally (424 pages), use `npm run generate:library`. The local Docker parser is beta and currently produces fewer pages — fine for testing the no-auth flow, not a substitute for CI generation.

**Known bug in the Fern Python library generator** (filed upstream): the generator emits cross-references that miss the `/nemo/curator` site basepath (links use `/nemo-curator/...` instead of `/nemo/curator/nemo-curator/...`) and tacks on Sphinx-style `#nemo_curator-…` fragments that don't match any rendered anchor. Result: ~540 broken links across the generated API reference.

Expand All @@ -347,7 +352,7 @@ python3 fern/_fix_broken_links.py
| `{{ variable }}` shows literally on site | Not in `DEFAULT_VARIABLES` in `substitute_variables.py` — add it there |
| MDX parse error | Replace bare `<https://...>` with `[text](https://...)`; escape `<` in prose with `&lt;` or backticks |
| Old Sphinx URL breaks | Add a `redirects:` entry in `fern/docs.yml` |
| Library reference missing | Run `fern docs md generate` in `fern/` (see `fern/AUTODOCS_GUIDE.md`) |
| Library reference missing | Run `npm run generate:library` in `fern/` (full reference; needs Fern auth). Or `npm run generate:library:local` without auth (Docker; beta, fewer pages). See `fern/AUTODOCS_GUIDE.md`. |
| Broken image | Path is relative to the MDX file; check `fern/assets/` or `pages/_images/` exists |

## Key References
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fern-docs-preview-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
env:
FERN_TOKEN: ${{ secrets.DOCS_FERN_TOKEN }}
working-directory: ./fern
run: fern docs md generate
run: fern docs md generate --library nemo-curator

- name: Generate preview URL
id: generate-docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-fern-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
env:
FERN_TOKEN: ${{ secrets.DOCS_FERN_TOKEN }}
working-directory: ./fern
run: fern docs md generate
run: fern docs md generate --library nemo-curator

- name: Publish Docs
env:
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# make docs # local dev server at http://localhost:3000
# make docs-check # validate Fern config + MDX
# make docs-login # guided dashboard sign-in + fern login
# make docs-generate-library # regenerate the Python API reference (libraries:)
# make docs-generate-library # regenerate the Python API reference (git; needs auth)
# make docs-generate-library-local # regenerate locally without Fern auth (Docker)
# make docs-substitute # substitute {{ variables }} in MDX (CI runs this automatically)
# make docs-substitute DOCS_VERSION=26.02
# make docs-preview # build a shared preview URL (needs DOCS_FERN_TOKEN)
Expand All @@ -14,7 +15,7 @@
#
# See fern/README.md for the full authoring guide.

.PHONY: docs docs-check docs-login docs-generate-library docs-substitute \
.PHONY: docs docs-check docs-login docs-generate-library docs-generate-library-local docs-substitute \
docs-preview docs-publish docs-clean docs-help

# Override FERN to pin a CLI version, e.g. `FERN=npx -y fern-api@4.43.1 make docs-check`.
Expand All @@ -40,7 +41,11 @@ docs-login:

docs-generate-library:
@echo "Generating Python API reference under $(FERN_DIR)/product-docs/ (requires FERN_TOKEN)..."
cd $(FERN_DIR) && $(FERN) docs md generate
cd $(FERN_DIR) && $(FERN) docs md generate --library nemo-curator

docs-generate-library-local:
@echo "Generating Python API reference locally under $(FERN_DIR)/product-docs/ (Docker; no Fern auth)..."
cd $(FERN_DIR) && $(FERN) docs md generate --local --library nemo-curator-local

docs-substitute:
@echo "Substituting {{ variables }} in versions/v$(DOCS_VERSION) MDX..."
Expand All @@ -67,7 +72,8 @@ docs-help:
@echo " docs local dev server (http://localhost:3000)"
@echo " docs-check validate Fern config + MDX"
@echo " docs-login guided dashboard sign-in + fern login"
@echo " docs-generate-library regenerate Python API reference (libraries:)"
@echo " docs-generate-library regenerate Python API reference via git (needs auth)"
@echo " docs-generate-library-local regenerate locally without Fern auth (Docker)"
@echo " docs-substitute run substitute_variables.py on a version tree"
@echo " (override version: make docs-substitute DOCS_VERSION=26.02)"
@echo " docs-preview build a shared preview URL (needs DOCS_FERN_TOKEN)"
Expand Down
8 changes: 7 additions & 1 deletion fern/AUTODOCS_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ Notes:
Run:

```bash
fern docs md generate
fern docs md generate --library nemo-curator
```

For local generation without Fern authentication (requires Docker):

```bash
fern docs md generate --local --library nemo-curator-local
```

Fern will generate markdown under the output path you configured, for example:
Expand Down
13 changes: 12 additions & 1 deletion fern/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ fern generate --docs # static build

For prose-only iteration, `fern docs dev` is enough. Library reference (`product-docs/`) is regenerated by Fern on `dev`/`generate` from the `libraries:` block in `docs.yml`. See [`./AUTODOCS_GUIDE.md`](./AUTODOCS_GUIDE.md) for how that works.

### Library reference without Fern login

CI and deploy previews use the `nemo-curator` library (`input.git`) and require `fern login` or `FERN_TOKEN`. For local iteration on the Python API reference without Fern authentication, use the `nemo-curator-local` entry (`input.path`) with Docker:

```bash
npm run generate:library:local
# equivalent: fern docs md generate --local --library nemo-curator-local
```

Both libraries write to the same output folder (`product-docs/nemo-curator/Full-Library-Reference`), so previews and publish keep working unchanged. Requires Docker (Fern pulls `fernapi/fern-python-library-docs-parser` on first run).

### Variable substitution

CI runs `substitute_variables.py` before `fern generate` so `{{ container_version }}` and other tokens in MDX are replaced. To run locally (from repo root):
Expand Down Expand Up @@ -208,7 +219,7 @@ PR titles follow Conventional Commits (e.g. `docs(fern): add rollout collection

| Symptom | Fix |
|---|---|
| `HTTP 403: User does not belong to organization` on library generation | Sign in to https://dashboard.buildwithfern.com first, then re-run `fern login` |
| `HTTP 403: User does not belong to organization` on library generation | Sign in to https://dashboard.buildwithfern.com first, then re-run `fern login`. Or use `npm run generate:library:local` (no Fern auth; requires Docker). |
| `Folder not found: ./product-docs/...` in `fern docs dev` | Library generation hasn't run; trigger a `fern docs dev` cycle or check the `libraries:` block in `docs.yml` |
| `fern check` YAML error | 2-space indent; `- page:` inside `contents:`; `path:` is relative to the version YAML |
| Page 404 in preview | `slug:` missing/duplicated in the same section, or `position:` collision in an auto-discovered folder |
Expand Down
6 changes: 6 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ libraries:
output:
path: ./product-docs/nemo-curator/Full-Library-Reference
lang: python
nemo-curator-local:
input:
path: ../nemo_curator
output:
path: ./product-docs/nemo-curator/Full-Library-Reference
lang: python
Comment on lines +186 to +191

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Shared output path produces silently smaller reference on local machines

Both nemo-curator and nemo-curator-local write to the same Full-Library-Reference/ directory. Running generate:library:local after generate:library overwrites the full 424-page set with the beta Docker-parsed subset. A developer iterating locally may not notice the missing pages until they compare output sizes. The docs call this out, but a runtime guard — even just an echo warning — in the Makefile/npm script that the local flow produces fewer pages and overwrites any previous full generation would prevent confusion.


experimental:
mdx-components:
Expand Down
2 changes: 1 addition & 1 deletion fern/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization": "nvidia",
"version": "5.29.0"
"version": "5.50.4"
}
3 changes: 2 additions & 1 deletion fern/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"check": "npx -y fern-api@latest check",
"dev": "npx -y fern-api@latest docs dev",
"generate": "npx -y fern-api@latest generate --docs",
"generate:library": "npx -y fern-api@latest docs md generate"
"generate:library": "npx -y fern-api@latest docs md generate --library nemo-curator",
"generate:library:local": "npx -y fern-api@latest docs md generate --local --library nemo-curator-local"
},
"engines": {
"node": ">=20"
Expand Down
Loading