跳到导航

Fern Clerk

以 Markdown 格式查看

Fern Clerk is an AI agent that writes and maintains documentation from your code. It writes a first version of your docs from a repository, then keeps them in sync as your code changes.

If youFern Clerk will
Are setting up a new docs siteWrite the docs from your repository as part of setup, and show them on your site before you connect a docs repository
Have code but no docsWrite a first version of your docs from a repository
Have a docs siteKeep your docs in sync by reviewing your pull requests and proposing docs changes

Writing and syncing work together. After Fern Clerk writes a first version, it keeps that version current. Outside setup, Fern Clerk delivers every change as a pull request, so nothing changes your docs until you merge.

Write docs from your code

Fern Clerk reads a repository, plans a docs site, writes the pages, and checks that the site builds. It writes an API Reference from the API specs it finds in the repository, and guides from the code. You can start it while you set up a docs site, or later from the Automations page.

During docs site setup

The first step of creating a docs site in the Fern Dashboard is Generate docs from your code. Select Skip to set up the site without it.

1

Connect GitHub

Select Connect GitHub and sign in. Fern uses your account to read your product’s repository.

2

Install the Fern GitHub App

Pick the account or organization that owns your product’s repository, choose All repositories or only your product’s, and select Install. If an organization owner has to approve the installation, the step updates when they do.

3

Choose the repository

Select the product repository Fern Clerk should document. Setup then continues as usual with your site’s details and design.

To set the look and voice of the generated docs, use the Design polish and Writing style cards on the details step. Enter your website to have Fern pull colors and a logo from it, and add tone and style guidance, such as voice, audience, and terminology. Fern follows the guidance while writing and saves it as fern/AGENTS.md in the docs repository, so later changes use the same voice.

Fern publishes your site first. Fern Clerk then writes the API Reference and guides and publishes them onto your Fern-hosted site, as long as it isn’t connected to a repository yet, so you see the result on your live docs site without a pull request. The site’s deployment log shows each step.

You don’t need a docs repository for this. Setup doesn’t ask where the docs are stored, and the docs live on the Fern-hosted site until you connect a repository to it.

When you’re ready to edit the docs in Git, connect a repository to the docs site. From then on, Fern Clerk starts keeping the docs in sync with your code, using recommended settings. If you can’t manage your organization’s settings, an admin connects the repository, or you set Fern Clerk up from the Automations page instead. You can change the settings on the automation’s Settings tab. Reviews run with your access, so authorize Fern Clerk before it reviews anything.

From the automations page

If you skipped the setup step, and your docs site isn’t published yet, write a first version from the Automations page.

1

Pick the repository

If your docs site isn’t published yet, select Generate docs from your code during setup or on the automation’s page. Choose the repository to document, then where the docs pull request opens:

OptionWhat happens
In the same repositoryThe docs go in the repository’s fern/ folder. Changes under fern/ aren’t reviewed as code changes, so docs pull requests don’t trigger more docs pull requests.
In a separate repositoryEnter the repository as owner/name. It must have the same owner as the repository you’re documenting and no Fern docs yet. If the Fern GitHub App can’t see it, add the repository to the app before you generate. See Connect a GitHub repository for how.

Fern checks that your GitHub account can read the repository you’re documenting and write to the one the docs go in.

2

Review the pull request

The pull request describes the site’s plan and what the run left out. Claims Fern couldn’t trace to your code are marked (needs confirmation) on the page, and the pull request lists how many. Check those before you merge.

3

Merge to publish

The pull request adds up to three workflow files (check, preview, and publish), skipping any the repository already has, and a FERN_TOKEN secret if it doesn’t have one. Merging it publishes the site.

Adding the secret requires you to authorize Fern Clerk. Without it, the pull request leaves out the workflows and says docs CI was skipped. Authorize, then run it again.

Each repository can have one run in progress at a time. A repository can start 3 runs a day and an organization 10. If a run fails with a retryable error, select Retry on the run.

Keep docs in sync with your code

Fern Clerk reviews each pull request in the repositories you connect, decides whether the docs need to change, and opens a docs pull request when they do. It opens that pull request in the repository your docs site publishes from.

You control:

  • When a pull request is reviewed: after it merges, or while it’s still open. See Review trigger.
  • What happens when docs need to change: open a pull request, or only record what would change and post nothing to GitHub. See Observe only.
  • How changes are grouped: a docs pull request after each merge, or one daily or weekly digest. See Grouping.
  • Which paths to ignore: source paths whose changes never need docs. See Ignored paths.

Each reviewed pull request shows its decision and the docs pull request it produced. Mark a decision right or wrong with the thumbs up and thumbs down buttons. To see how it judges your changes before the next merge, select Review recent merges on the automation’s page. It reviews your last 10 merged pull requests and posts nothing to GitHub.

Setup steps and settings are in the Fern Clerk section of Fern Agent.

Authorize Fern Clerk

Reviews run in the background with nobody watching, so Fern Clerk acts as the person who set the automation up and sees and changes only what that person can. Until that person authorizes it, the automation shows Needs authorization and reviews nothing.

To authorize, select Authorize at the top of the automation’s page, or in the last step of setup. Fern opens a new tab where you sign in and approve letting Fern Clerk act as you. When the tab says the automation is authorized, close it. One authorization covers all your automations in the organization, and only the person who set an automation up can authorize it.

If the authorization stops working, the automation shows Reconnect needed and pauses until you grant it again.

Permissions and data

Fern Clerk needs the Fern GitHub App installed on the repositories it reads and on the repository your docs publish from. If the authorization of the person who set up an automation stops working, it pauses.

Fern Clerk redacts secrets from pull request content before reviewing it, skips credential files, and scans its docs edits for secrets before committing them.