Skip to content
Merged
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
96 changes: 88 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,95 @@
## File Structure
# CLAUDE.md

- `operator/` — current Operator docs (v4.x)
- `operator-v3/` — legacy Operator docs (v3.x)
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Code review conventions
## Overview

Every time you perform a code review, make sure that the files with the .md and .mdx extensions in the docs/sdk folder include a title and a description.
The StakeWise documentation site (https://docs.stakewise.io), built with Docusaurus 3.10 + React 19 + TypeScript. Content is MDX; the repo is content-heavy, not application code.

## Commands

## Git Conventions
```bash
yarn # install (Node >= 22, yarn classic)
yarn start # dev server with hot reload
yarn build # production build into build/ — this is what catches broken anchors/links
yarn serve # serve the built site
yarn typecheck # tsc
yarn clear # clear the .docusaurus cache (fixes most stale-build weirdness)
yarn checkRedirects # validate redirects.ts against renamed/deleted content (see below)
```

Use short commit messages only (no description or co-author).
There is no test suite and no linter. `yarn build` is the real gate: `onBrokenAnchors`, `onDuplicateRoutes`, and `onBrokenMarkdownLinks` are all set to `throw`, so a bad anchor or duplicate route fails the build (plain broken links only warn).

Leave the pull request summary empty when opening a PR, as GitHub Copilot will automatically generate the summary.
## Content architecture

Three separate docs plugin instances, each with its own content root, route, and sidebar file:

| Content dir | URL | Sidebar file | Plugin |
|---|---|---|---|
| `docs/` | `/` | `sidebars.ts` | classic preset (`routeBasePath: '/'`) |
| `operator/` | `/operator/*` | `sidebarsOperator.ts` | `plugin-content-docs` id `operator` |
| `staker/` | `/staker/*` | `sidebarsStaker.ts` | `plugin-content-docs` id `staker` |

Because the default instance serves from `/`, the `docs/` directory holds three navbar sections at once:

- `docs/docs/**` → `/docs/*` — protocol concepts (vaults, osToken, oracles, fees, governance). Sidebar entries are listed manually in `sidebars.ts` (`docsSidebar`).
- `docs/contracts/**` → `/contracts/*` — autogenerated sidebar.
- `docs/sdk/**` → `/sdk/*` — autogenerated sidebar.

Adding a page to a manually-listed sidebar (`docsSidebar`, `operatorSidebar`, `stakerSidebar`) requires editing the corresponding `sidebars*.ts`. In autogenerated sections, ordering comes from `_category_.json` (`position`, `label`, optional `link`) plus numeric directory prefixes (`01-vault`, `02-boost`) and `sidebar_position` frontmatter.

### Synced / mirrored content — do not hand-edit

- `docs/sdk/**` is synced from the [stakewise/v3-sdk](https://github.com/stakewise/v3-sdk) repo (`external/sdk` is a gitignored submodule; the periodic "Sync SDK documentation" PRs overwrite this tree). Fix SDK docs upstream in v3-sdk, not here.
- `docs/contracts/api/**` mirrors the v3-core Solidity source tree and NatSpec — each page links back to a pinned v3-core commit. Directory layout follows `contracts/` in v3-core.

### Redirects are mandatory

Moving, renaming, or deleting any file under `docs/`, `operator/`, or `staker/` requires an entry in `redirects.ts`. This is enforced twice: the husky `pre-commit` hook runs `yarn checkRedirects`, and `.github/workflows/check-redirects.yml` pipes a rename-aware `git diff` into `yarn checkRedirects --stdin`.

`scripts/checkRedirects/` also rejects duplicate `from` values and verifies that any `#anchor` in a `to` target actually exists as a heading in the destination file. URL derivation (`util/contentRoots.ts`): strip the extension, lowercase, drop a trailing `/index`, and map `docs/` → ``, `operator/` → `/operator`, `staker/` → `/staker`.

## MDX conventions

Frontmatter is `title` + `description` (the description feeds SEO metadata and the JSON-LD schema injected by `src/theme/Root.tsx`). Synced SDK pages additionally use `id` and explicit `slug`.

**Admonitions** — the site uses five custom types instead of the Docusaurus defaults:

```mdx
:::custom-info[Example]
...
:::
```

`custom-info`, `custom-notes`, `custom-tips`, `custom-warning`, `custom-stakewise`. They're rendered by `src/theme/Admonition/Types.js` and must be declared in the `admonitions.keywords` list of **every** docs plugin in `docusaurus.config.ts` — adding a new type means editing three places.

**Components** — import from the barrel:

```mdx
import { CommandSnippet, CheckItem, Tooltip } from '@site/src/components';
```

- `CommandSnippet` — code block with inline editable fields; wrap the user-supplied parts in double braces: ``<CommandSnippet template={`./operator start --vault={{0x834F...}}`} />``. Multi-line templates use escaped `\\` line continuations.
- `Tooltip` — inline glossary hovers, `content` takes JSX.
- `CheckItem` — checkbox persisted to `localStorage` under `check_{id}`.

**Images** — `import Image from '@theme/IdealImage'` then `<Image img={require('./img/foo.png')} alt="foo" />`. The theme override (`src/theme/IdealImage/index.tsx`) adds a `sources={{light, dark}}` prop for theme-aware screenshots.

**Links** — external links get a `↗` suffix, internal cross-references a `→`: `[Automated Node Setup →](/operator/manage-validators/automated-node-setup)`, `[app.stakewise.io ↗](https://app.stakewise.io)`. `src/theme/CustomLink/CustomLink.tsx` handles `target`/`rel` automatically, so never write raw `<a target="_blank">`.

## Operator docs are version-split

`operator/*` documents Operator Service **v4** (current). `operator/operator-service-v3/**` is a parallel, frozen tree for vaults below version 5 on Ethereum / 3 on Gnosis. Both trees have near-identical `alternative-key-management/` pages — when updating one, check whether the change also applies to the other.

Docker image tag bumps (`europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:vX.Y.Z`) live in `operator/launch-operator-service.mdx` and `operator/start-operator.mdx`.

## Styling

- SCSS partials in `src/css/*.scss`, all imported by `src/css/custom.scss` (the single `customCss` entry). These target Docusaurus theme classes globally.
- Tailwind v4 is wired through a tiny local plugin (`src/plugins/tailwind-config.js` → `@tailwindcss/postcss`) and is only pulled in by the homepage (`src/pages/index.tsx` imports `src/css/tailwind/config.css`). Doc pages are SCSS-only.
- Components use CSS modules (`*.module.scss`).
- `Root.tsx` sets `data-page="home|inner"` and `data-scrolled` on `<html>`; several styles key off those attributes.

## Code style (src/)

No semicolons, single quotes, 2-space indent, `export default X` at the bottom after two blank lines, props typed via a local `type XProps = {...}`.
2 changes: 1 addition & 1 deletion docs/docs/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A validator type that supports variable effective balances from 32 ETH up to 204
The process of merging multiple legacy validators (0x01) into compound validators (0x02), or combining the balance of existing compound validators to improve capital efficiency and reduce infrastructure overhead.

### <img src="/icons/glossary/dao-approved-vault.png" alt="DAO-Approved Vault" style={{width: '24px', height: '24px', display: 'inline', verticalAlign: 'middle'}} /> DAO-Approved Vault
Vaults that meet stringent DAO criteria (defined in [SWIP-24 ↗](https://forum.stakewise.io/t/swip-24-establish-a-policy-for-enabling-100-oseth-minting-in-select-vaults/1724)) and qualify for 100% minting threshold (LTV) for osETH/osGNO—enabling automatic liquid staking token issuance without overcollateralization.
Vaults that meet stringent DAO criteria (defined in [SWIP-24 ↗](https://forum.stakewise.io/t/swip-24-establish-a-policy-for-enabling-100-oseth-minting-in-select-vaults/1724)) and qualify for a near-100% minting threshold (LTV) for osETH/osGNO—enabling automatic liquid staking token issuance without overcollateralization.
This maximizes capital efficiency and unlocks advanced use cases like consumer liquid staking, exchange integrations, and leveraged DeFi strategies.
Requirements include substantial stake (≥10k ETH / ≥5k GNO), fee caps (≤5% / ≤15%), above-median performance, Vault v3, significant SWISE bond (5M / 1M), and DAO governance approval.

Expand Down
Loading