-
Notifications
You must be signed in to change notification settings - Fork 23
ADR 0034 documentation standard publication #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MGibson1
wants to merge
11
commits into
main
Choose a base branch
from
arch/docs/documentation-standard-publication
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
db6c0dc
Introduce documentation standardization for at all communication levels
MGibson1 f86488b
Remove AI instruction files from documentation scope
MGibson1 2f0b8a4
Bump ADR date to PR request date
MGibson1 17c4a81
wrap filename references in ``
MGibson1 1134bca
Open up ADR plan to drift outside of clients repository
MGibson1 27e3a22
fill in documentation standard for adr 0034
MGibson1 a98cbc3
wrap filename references in ``
MGibson1 86711f0
Exclude ADRs from audience requirements
MGibson1 6e66afd
Remove unused custom word
MGibson1 3b6856c
Plugin renamed to avoid weird usage of currency
MGibson1 665bd2a
Merge branch 'main' into arch/docs/documentation-standard-publication
MGibson1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
docs/contributing/documentation/component-documentation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| sidebar_position: 1 | ||
| --- | ||
|
|
||
| # Component documentation | ||
|
|
||
| **Audience:** Bitwarden engineers and AI agents writing or consuming in-repo documentation. | ||
|
|
||
| Notation follows the [documentation standard's Notation](./index.md#notation). These requirements | ||
| hold for every repo for as long as it lives, enforced by review and the doc-parity plugin. New | ||
| repositories satisfy them at initialization by starting from | ||
| [bitwarden/template](https://github.com/bitwarden/template). Existing repos converge per | ||
| [Changes to this standard](./index.md#changes-to-this-standard). Additional local guidance MAY be | ||
| layered on top, as each situation dictates. | ||
|
|
||
| Any component that other engineers or agents consume (that is, it exposes a public interface) MUST | ||
| have an **entry point for its scope's documentation**, at every scope from a single component to the | ||
| repo root. The entry point lives where the component's ecosystem surfaces documentation: | ||
|
|
||
| - At **component scope**, the entry point is the `README.md`, which registries render for packaged | ||
| components (a crate, an npm package, a NuGet project). Rust crates keep the README and the rustdoc | ||
| landing page one artifact with `#![doc = include_str!("../README.md")]`. | ||
| - **Below component scope**, the entry point is the language's module-level documentation where it | ||
| exists (`//!` in Rust), since a README there duplicates what the toolchain already owns and no | ||
| tooling surfaces it. It SHOULD be lint-enforced where the language supports it (Rust's | ||
| `missing_docs`). | ||
| - At **container and system scopes** (a container grouping several components, the repo root), the | ||
| entry point is a `README.md`, since no language ecosystem claims them. | ||
|
|
||
| Whatever its carrier, the entry point MUST contain: | ||
|
|
||
| 1. **Purpose:** what problem this component solves, in 1–3 sentences. | ||
| 2. **Key concepts:** the domain model or invariants a consumer must know (e.g., `libs/state`'s | ||
| data-loss warning on key renames; `bitwarden-crypto`'s `derive_`/`make_` naming rules). | ||
| 3. **Usage:** the primary entry points, with a short code sample where the API is not self-evident. | ||
| 4. **Gotchas / constraints:** the things that bite people (e.g., `libs/auth`'s "do not add new code | ||
| here" notice). This section MUST exist when such constraints do and MUST NOT exist when they do | ||
| not. | ||
|
|
||
| Documentation grows outward from the entry point of the | ||
| [lowest common ancestor](./index.md#where-documentation-lives-rules-1-2) of the code it describes. A | ||
| guide spanning several components therefore belongs to their parent scope: | ||
|
|
||
| 1. Everything starts at the scope's entry point. | ||
| 2. A single topic that deserves its own document becomes a named `.md` next to the code it | ||
| describes, linked from the entry point (`apps/browser/src/autofill/lifecycle.design.md` is the | ||
| exemplar). | ||
| 3. When the scope's documentation outgrows this, it splits into a `docs/` folder (exactly that name, | ||
| lowercase) at the scope root. `docs/` exists only beside the entry point it extends: at the repo | ||
| root (`clients/docs/cipher-types.md` is the exemplar) or a component with its own entry point | ||
| (`util/Seeder/Seeds/docs/`), never an arbitrary subdirectory. | ||
|
|
||
| Scopes layer and multiple perspectives exist. A parent scope's documentation MAY describe the same | ||
| code at a higher altitude, sanding off detail the deeper docs own and linking down to them, and the | ||
| same subject MAY be documented separately per audience. Both are approved. Duplication is two | ||
| artifacts sharing one perspective. | ||
|
|
||
| Below component scope, reference documentation is code: doc comments on public symbols, reviewed and | ||
| merged with functionality, lint-enforced where the platform supports it. Doc comments MUST follow | ||
| the language's documentation norms for structure and detail. Where not enforced by the type system, | ||
| doc comments MUST say what a caller needs (behavior, invariants, error cases). Repos with doc CI | ||
| SHOULD fail the build on broken docs (the `sdk-internal` `cargo doc -D warnings` pattern). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍