Commit Graph
4 Commits
Author SHA1 Message Date
Nick Vigilante 2e0f97e5de feat: add type and secret status to the configuration reference (DOCS-896) (#29310)
## Summary

The generated configuration reference told a reader how to set each
deployment option but not what the option accepts. Every entry carried
the environment variable, CLI flag, YAML key, and default, while
serpent's value type stayed in the source. A reader could not tell a
`duration` from an `int`, or discover an enum's accepted values, without
following the flag link into the CLI reference.

- **Type** is now rendered for all 200 options from the serpent value.
Enums expand into their choices (`- Type: `enum`, one of `password`,
`awsiamrds``) rather than printing serpent's escaped `enum[a\|b]`
spelling, which is meant for its own table output.
- **Secrets** are now marked. The nine options carrying the `secret`
annotation that `codersdk.IsSecretDeploymentOption` reads are
deliberately excluded from YAML, so the page now says where to set them
instead of leaving the omission unexplained.

## Correction to the issue

DOCS-896 claimed the page showed a YAML key for secret options. It does
not: all nine secret options have an empty `YAML` field, so the
generator already omitted that bullet. The real gap was that nothing
explained *why* the YAML key is missing. The page header and the
per-option marker now cover it.

## Verification

- `go test ./scripts/configdocgen` passes, with new cases for the
enum-choice parsing, plain and nil value types, and the secret marker
rendering exactly once for the annotated option.
- Regenerated page has 200 `- Type:` lines for 200 rendered options and
9 secret markers.
- `make lint/emdash`, markdownlint, `markdown-table-formatter`, and Vale
are clean on the regenerated page. `golangci-lint` clean on the package.
Full `make pre-commit` passed.

<details>
<summary>Local pre-push note</summary>

The repository pre-push hook runs the full Go suite locally. In this
workspace it segfaults the `make` process outright, and an isolated
`make test` run produces ~1,000 failures unrelated to this change
(embedded NATS servers failing to start within 10s, chatd state-machine
tests), which reproduce independently of this diff. I verified the
change with `go build ./...`, the package tests above, and the full
pre-commit suite instead, and disabled the hook for this worktree only
using its documented `git config coder.pre-push` knob, restoring the
setting immediately after the push. No `--no-verify`. CI is the
authority on the full suite here.

</details>

---

Generated with Coder Agents on behalf of @nickvigilante. Linear:
[DOCS-896](https://linear.app/codercom/issue/DOCS-896/configdocgen-render-option-type-and-secret-status)
2026-10-01 16:50:42 -04:00
Nick Vigilante d40e24cf7d docs: nest the CLI reference by subcommand (#29956)
## Summary

Nests the CLI reference by subcommand so the Command Line sidebar
collapses from 156 flat entries to 49 top-level verbs.
Each page's URL follows the invocation, its page title is the full
command as inline code, and its sidebar label is only its own verb as
inline code.

| | Before | After |
| --- | --- | --- |
| File | `docs/reference/cli/oauth2-provider_dcr_disable.md` |
`docs/reference/cli/oauth2-provider/dcr/disable.md` |
| URL | `/reference/cli/oauth2-provider_dcr_disable` |
`/reference/cli/oauth2-provider/dcr/disable` |
| Page title (front matter) | `oauth2-provider dcr disable` | `` `coder
oauth2-provider dcr disable` `` |
| Sidebar label (manifest) | `oauth2-provider dcr disable` | ``
`disable` `` |

Resolves DOCS-140 (coder/coder half). Also fixes the Makefile part of
DOCS-1073 / DOCS-912, which this change depends on.

## Changes

- `scripts/clidocgen`: pages nest by command path. A command with
visible subcommands becomes its directory's `index.md`, so
`oauth2-provider/index.md` and `oauth2-provider/dcr/index.md` sit above
`oauth2-provider/dcr/disable.md`. Subcommand table links are relative to
the parent page.
- `scripts/clidocgen`: the manifest "Command Line" section is built from
the command tree (nested, sorted by name, hidden commands skipped)
instead of a flat list. The redundant `coder` child that pointed back at
`reference/cli/index.md` is gone.
- `Makefile`: the CLI rule now replaces `docs/reference/cli/` wholesale,
so stale pages get removed. The manifest rule now runs `clidocgen
-manifest-only` on top of the API staging manifest, so the CLI nav is
generated instead of edited by hand. As a result, the nine pages that
had no nav entry (`ai-gateway*`, `secret enable/disable`, `server
fix-oidc-links`) now have one.
- `scripts/configdocgen` and 48 prose pages: links point at the new
paths (for example `reference/cli/server.md` is now
`reference/cli/server/index.md`).

## How to review/QA this PR

- `docs/reference/cli/**/*` (approximately 190 pages): Each of these
pages are generated automatically. Some pages appear deleted, and some
pages appear new. Every deleted page corresponds to a new page somewhere
else, so no information is being deleted. The docs in this section
should adhere to the following, so a test in the build preview for each
of these items should be satisfactory:
- [ ] Each subcommand of a command gets nested as a child instead of
being displayed as a flat list.
  - [ ] Each parent command is stored in an `index.md` file.
- [ ] The title of each page inside the page should now feature the full
`coder XYZ` command.
- [ ] The title of each page inside the page should now be formatted as
inline code.
- [ ] The title of each page in the sidebar should be the most granular
subcommand of the whole command string (if the page's title is `coder
ai-gateway keys create`, the sidebar label is `create`).
- [ ] The title of each page in the sidebar should now be formatted as
inline code.
  - [ ] The page slug for each page is now the most granular subcommand.
  - [ ] All links now point to the correct page.
- `docs/manifest.json`: The changes here reflect the updated structure
of the `docs/reference/cli` section.
- `docs/**/*.md` outside of `docs/reference/cli/**/*` (approximately 50
pages): The extent of the changes in these pages are just updating the
paths to point to the new page locations.
- [ ] The links on the page all point to the correct new path in
`docs/reference/cli`.
- `scripts/clidocgen` (4 files): This is the Go code responsible for
generating everything inside of `docs/reference/cli/**/*`. A typical
code review here should be satisfactory.
- `scripts/configdocgen` (2 files): these two files just have updates to
the raw `.md` path used by `docs/admin/setup/configuration-reference.md`
and updates the tests to reflect that.
- `Makefile`: This updates the `make` targets for generating the CLI
docs to fit the new structure.

## Merge ordering

Without the renderer PRs deployed, both docs sites show literal
backticks in titles and sidebar labels. Without the redirects, the old
flat URLs return 404.

1. Deploy before merging this PR: coder/docs-engine#176 (beta-docs
renders these titles as inline code) and coder/coder.com#1111 (classic
docs renders them as inline code). Both are safe to ship first, because
titles without backticks render as before.
2. Merge this PR.
3. Merge coder/coder.com#1112 (redirects from the old flat URLs) only
once this content reaches the mainline release branch that serves
unversioned `/docs`.

## Testing

- `go test ./scripts/clidocgen/ ./scripts/configdocgen/
./scripts/docshtmlcheck/`: pass. New tests cover page paths, subcommand
links, the nested manifest, and front matter quoting.
- `make docs/reference/cli/index.md docs/manifest.json
docs/admin/setup/configuration-reference.md`, then a forced rerun: the
second run produced no diff.
- Checked the manifest: all 164 CLI entries resolve to a file, no page
is missing a nav entry, and everything outside "Command Line" is
byte-identical.
- Relative `.md` links across `docs/`: 0 broken, same as `main`.
- `make pre-commit` and `make pre-push`: pass. On earlier pre-push
attempts, different unrelated vitest files timed out under host load.
Those files pass when run alone, and the final push passed with
`PARALLEL_JOBS=1`.

<details>
<summary>Implementation plan and decision log</summary>

**Goal (from DOCS-140 and the requester):** URLs follow the command
hierarchy. Pages are titled with the full command, and sidebar entries
with the last verb only. Both are formatted as inline code.

**Contract with the renderers:** a title wrapped entirely in one pair of
backticks (``^`[^`]+`$``) renders as inline code. Plain-text consumers
(`<title>`, meta, search, llms corpus) strip the backticks. Page title
comes from front matter `title`, and the sidebar label from the manifest
node `title`.

**Decisions**

- A parent command is `dir/index.md` rather than a sibling `dir.md`. The
root CLI page is already `index.md`, and both docs-engine and the legacy
coder.com renderer map `x/index.md` to `/x`.
- The manifest is built from the command tree, not from the written
files, so ordering is deterministic and the nesting matches the pages
exactly.
- The manifest discard bug (DOCS-1073 item 1) is fixed here, because
without that fix the generated nested manifest would never reach the
tree. DOCS-1073 items 2 through 4 (a prose fix and a hidden-command
policy) are out of scope.
- `-manifest-only` keeps the existing parallel `make gen` layout: the
API rule still owns `_gen/manifest-staging.json`, and CLI regeneration
doesn't retrigger swag.
- The renderer and redirect work lives in the companion PRs in
coder/docs-engine and coder/coder.com. It is linked above and not
duplicated here.

</details>

---

> [!NOTE]
> Generated by Coder Agents on behalf of @nickvigilante.
2026-09-28 15:44:10 -04:00
Nick Vigilante d7b6528d7e docs: cap the config reference TOC and drop the Dangerous emoji (#29857)
## Merge order

Standalone; no dependency on the other DOCS-977 PR (task-list
checkboxes).

## Summary

Tracy and Ian flagged the mixed checkbox/emoji styling in the docs
(Slack thread linked from DOCS-977), including the `⚠️ Dangerous`
heading that `scripts/configdocgen` generates from
`codersdk.DeploymentValues`.
The generated configuration reference also has around 130 `h3` headings,
which makes its "On this page" list unreadable.

This PR changes only the generator, `scripts/configdocgen`, and
regenerates `docs/admin/setup/configuration-reference.md` from it.

## Design or Fix

- Emit `toc_depth: 2` frontmatter at the top of the generated page,
before the `<!-- DO NOT EDIT -->` comment.
docs-engine's sync (`packages/docs-build/src/sync.ts`) reads a page's
own frontmatter before stripping it, so this caps the on-page TOC at h2
without any docs-engine change.
- Strip any leading emoji or symbol from generated section headings
(`stripLeadingSymbol`), so the Dangerous heading reads "Dangerous"
instead of "⚠️ Dangerous".
`sectionRank`'s "Dangerous last" ordering still keys off the raw serpent
group name, so ordering is unaffected.
- Render a GitHub `[!CAUTION]` alert directly under the Dangerous
heading, using the group's own codersdk description when it has one,
otherwise a short fallback ("These options can break your deployment or
weaken its security...").
The `⚠️ Dangerous` group name in `codersdk/deployment.go` is unchanged,
because the CLI and other output use it.

## Testing

- `go test ./scripts/configdocgen/...` — 45 passed (7 new/updated cases:
`TestStripLeadingSymbol`, `TestRenderDangerousWithDescription`, and
updated `TestRenderPipeline` assertions for the stripped heading, the
Caution alert, and its position between the heading and the first
option).
- `go vet ./scripts/configdocgen/...` and `gofmt -l
scripts/configdocgen/*.go` — clean.
- `make docs/admin/setup/configuration-reference.md` — regenerated the
page (never hand-edited); this also runs `markdownlint-cli2 --fix` and
`markdown-table-formatter` as part of the make target, both clean.
- `go run ./scripts/docshtmlcheck` — clean.
- Verified with a small Node script against docs-engine's built
`parseFrontmatter`/`extractTitle` (from
`packages/docs-transforms/dist/transform.js`, at the commit that
introduced `toc_depth` support) that a page shaped like the regenerated
one — `toc_depth: 2` frontmatter followed by the `<!-- DO NOT EDIT -->`
comment and then the `# Configuration reference` H1 — parses `toc_depth:
2` and the title correctly.

## QA

Confirmed via the docs-engine sync parser directly (see Testing) that
`toc_depth: 2` is picked up correctly from this file shape.
I did not spin up docs-engine's dev server against this worktree: my
local docs-engine checkout is behind `origin/main` by several commits
including the one that added `toc_depth` support, so a faithful local
preview would first need a docs-engine rebuild against `origin/main`.
Given the direct parser verification above already confirms the
mechanism, I judged the full dev-server rebuild too heavy for the
marginal confidence gained and skipped it.

Expected rendering, based on the diff and docs-engine's documented
`toc_depth` behavior:

- The "On this page" TOC lists only h2 sections (General, Dangerous, and
the rest), not the ~130 option h3s.
- The Dangerous section renders as a plain "Dangerous" heading, followed
immediately by a Caution callout, with no emoji.

## Upstream

No. This is Coder product documentation generation (`codersdk`-driven),
not a Fumadocs engine change.

Linear:
[DOCS-977](https://linear.app/codercom/issue/DOCS-977/docs-replace-emoji-checkboxes-and-emoji-headings-with-one-icon-style)

---
🤖 Built with AI assistance.
2026-09-24 15:21:48 -04:00
ba4779fc87 docs: lead with env vars in admin docs and add configuration reference (#26824)
## What & why

Admin/setup docs lead with `coder server --flag` examples, but most
operators configure Coder through `CODER_*` environment variables
(system service, container, or Helm chart). There is no single page
mapping a setting to its env var, CLI flag, YAML key, and default, so
searching the docs for an env var name such as `CODER_PG_CONNECTION_URL`
returns nothing.

This adds a generated configuration reference and begins shifting admin
docs to lead with the environment-variable form.

## Changes

- **Generated configuration reference**
(`docs/admin/setup/configuration-reference.md`): a searchable,
per-setting list of every visible deployment option. Each option is a
heading (grouped and nested by serpent group) followed by its
description and the environment variable, CLI flag, YAML key, and
default that apply to it. Generated from `codersdk.DeploymentValues` so
it stays in sync.
- **Generator + `make gen` wiring** (`scripts/configdocgen/`): new
binary plus a Makefile target and `GEN_FILES` entry, mirroring the
existing `clidocgen` / `auditdocgen` pattern. Output is host-independent
(same env normalization as `clidocgen`).
- **Demo conversion** (`docs/admin/users/github-auth.md`): inverted to
lead with the `/etc/coder.d/coder.env` env-var form; the CLI-flag form
becomes a closing note that links to the reference. H2 slugs preserved.
- **Style guide** (`.claude/docs/DOCS_STYLE_GUIDE.md`): documents the
env-var-first convention for admin/setup docs.
- **Navigation**: manifest entry under Administration → Setup, plus a
TIP callout on the setup index.

## Risk

Docs + gen pipeline only; no runtime change. The page is regenerated by
`make gen`; the `gen` and `check-docs` CI checks pass.

## Follow-up

Several other admin pages still lead with flag walls. Recommend sweeping
them incrementally in separate PRs rather than expanding scope here.

<details>
<summary>Implementation notes (provenance, conflict resolution,
verification)</summary>

- Continues prior work by @aslilac and @bpmct from the
`kayla/docs-env-vars-first` branch. Both original commits are
cherry-picked here with authorship preserved.
- Rebased onto current `main`. Resolved two `Makefile` conflicts where
`main` had since added the `feature-stages.md` gen target at the same
locations; kept both targets (union) in `GEN_FILES`, `gen/mark-fresh`,
and the recipe block.
- The original branch's checked-in page predated recent
`codersdk.DeploymentValues` changes, so it was **regenerated** against
current `main` (adds `CODER_SCIM_USE_LEGACY`, the `Networking / Cluster`
section with `CODER_CLUSTER_HOST`, `CODER_BOUNDARY_LOG_RETENTION`, and
the AI Gateway description rename). The `gen` CI check enforces this
stays current.
- Fixed flag-link anchors for short-form flags (`--config`,
`--log-filter`): the generator derives the anchor from `FlagShorthand`
to match `clidocgen`'s heading (e.g. `#-l---log-filter`).
- `linkspector` ignores the AWS Bedrock base URL that appears as an
illustrative `<region>` placeholder in an option description, consistent
with the existing `openai.com` ignore patterns.

</details>

<details>
<summary>Configuration reference layout (2026-07-08 update)</summary>

Reworked the reference from a wide table into a nested, per-setting list
so it fits without horizontal scrolling and stops repeating the group
name in every heading:

- **List, not table.** Each option renders as a heading, its
description, and a bullet list of only the configuration methods that
apply to it (non-applicable methods are omitted instead of shown as
`-`).
- **Nested sections.** Sections nest by the serpent group hierarchy, so
`Email / Email Authentication` becomes `Email` (h2) with an `Email
authentication` (h3) subsection instead of a redundant flat title.
- **Shorter, sentence-case headings.** The redundant group prefix is
stripped from each option name and the remainder is lowercased to
sentence case, preserving acronyms and mixed-case tokens (`URL`, `TLS`,
`OAuth2`, `GitHub`) plus a small proper-noun allowlist (`Coder`,
`Terraform`, `Honeycomb`, `Anthropic`, `Bedrock`, ...). Example: `AI
Gateway Send Actor Headers` becomes `Send actor headers`.
- **Deprecated options** sort to the end of each section and lead with
an emphasized **Deprecated** marker. Headings stay clean (no
`(deprecated)` suffix) so their anchors remain stable.
- **Section intros** render from a group's `Description` when the source
defines one (e.g. DERP); no hand-maintained prose or links are
introduced.

All transformations run in pure Go at `make gen` time (no AI at
generation time). Generation is idempotent, and `markdownlint` and
`golangci-lint` both pass.

</details>

---

🤖 Opened by Coder Agents on behalf of @nickvigilante. Continues work by
@aslilac and @bpmct.

---------

Co-authored-by: Kayla (via Coder Agents) <kayla@coder.com>
Co-authored-by: Coder Agents <noreply@coder.com>
Co-authored-by: Ben Potter <me@bpmct.net>
2026-08-03 14:33:01 -04:00