beads/docs/cli-reference/formula.md
Chris Sells 4ea6fa3ac0 docs(emitter): emit Mintlify CLI reference and generated docs.json nav
bd help --docs-root now additionally writes docs/cli-reference/ in Mintlify
form (frontmatter title as H1, extensionless root-relative links, JSX
auto-generated markers since Mintlify parses .md through MDX) and rewrites
the CLI Reference pages array inside docs/docs.json via a textual splice
that leaves the rest of the file byte-identical — the ~113 nav entries are
never hand-maintained. The Docusaurus outputs (docs/CLI_REFERENCE.md,
website/docs/cli-reference/, versioned snapshots) are unchanged.

generate-cli-docs.sh --check seeds docs/docs.json and docs/cli-reference/
into its scratch root and diffs both; check-cli-docs-drift.sh adds them to
GEN_PATHSPECS and the regeneration fingerprint; docs-autofix-push.sh
allowlists the new generated paths; check-doc-flags.sh scans the new
docs/ subdirectories and requires command coverage in docs/cli-reference/.

Includes the initial docs/docs.json scaffold (nav mirrors the Docusaurus
sidebar IA) and the generated docs/cli-reference/ pages.

TDD: new emitter behavior covered in cmd/bd/help_all_test.go
(Mintlify page format, nav splice correctness + idempotence, bare-root
generation without docs.json).
2026-07-12 10:37:07 -07:00

144 lines
4.3 KiB
Markdown

---
title: "bd formula"
description: "Manage workflow formulas"
---
{/* AUTO-GENERATED: do not edit manually */}
Generated from `bd help --doc formula`.
Manage workflow formulas - the source layer for molecule templates.
Formulas are TOML/JSON files that define workflows with composition rules.
Define formulas, cook them into protos, then pour or wisp them into work.
Search paths (in order):
1. <resolved-beads-dir>/formulas/ (active project)
2. <checkout-root>/.beads/formulas/ (repo-local formulas)
3. ~/.beads/formulas/ (user)
4. $GT_ROOT/.beads/formulas/ (shared workspace root, if GT_ROOT set)
Commands:
list List available formulas from all search paths
show Show formula details, steps, and composition rules
schema Show the formula schema index (alias: primitives)
Discovering primitives:
bd formula schema # list every declared formula struct
bd formula schema loop # show LoopSpec fields, types, and tags
bd formula primitives gate # alias; same handler as 'schema'
examples/formulas/primitives/ # curated, smoke-tested wired fixtures
website/docs/workflows/formulas.md # narrative reference
```
bd formula [flags]
```
## bd formula convert
Convert formula files from JSON to TOML format.
TOML format provides better ergonomics:
- Multi-line strings without \n escaping
- Human-readable diffs
- Comments allowed
The convert command reads a .formula.json file and outputs .formula.toml.
The original JSON file is preserved (use --delete to remove it).
Examples:
bd formula convert shiny # Convert shiny.formula.json to .toml
bd formula convert ./my.formula.json # Convert specific file
bd formula convert --all # Convert all JSON formulas
bd formula convert shiny --delete # Convert and remove JSON file
bd formula convert shiny --stdout # Print TOML to stdout
```
bd formula convert <formula-name|path> [--all] [flags]
```
**Flags:**
```
--all Convert all JSON formulas
--delete Delete JSON file after conversion
--stdout Print TOML to stdout instead of file
```
## bd formula list
List all formulas from search paths.
Search paths (in order of priority):
1. &lt;resolved-beads-dir&gt;/formulas/ (active project - highest priority)
2. &lt;checkout-root&gt;/.beads/formulas/ (repo-local formulas)
3. ~/.beads/formulas/ (user)
4. $GT_ROOT/.beads/formulas/ (shared workspace root, if GT_ROOT set)
Formulas in earlier paths shadow those with the same name in later paths.
To list the declared formula schema structs an agent can write inside a .formula.toml,
use 'bd formula schema' (alias: 'bd formula primitives').
Examples:
bd formula list
bd formula list --json
bd formula list --type workflow
bd formula list --type convoy
```
bd formula list [flags]
```
**Flags:**
```
--type string Filter by type (workflow, expansion, aspect, convoy)
```
## bd formula schema
Show the formula schema index: every exported struct declared
in a .formula.toml/.formula.json, with field names, types, and tags.
The index is generated from internal/formula/types.go via go:generate; the
struct definitions are the source of truth, so this list cannot drift. It is
structural reference, not proof that every declared runtime behavior is wired.
Examples:
bd formula schema # list every declared schema struct
bd formula schema loop # show LoopSpec fields
bd formula primitives gate # alias; shows Gate fields
bd formula schema --json # machine-readable index
Curated smoke-tested fixtures for wired primitives live in
examples/formulas/primitives/ (with a smoke harness that proves they work).
```
bd formula schema [primitive] [flags]
```
**Aliases:** primitives
## bd formula show
Show detailed information about a formula.
Displays:
- Formula metadata (name, type, description)
- Variables with defaults and constraints
- Steps with dependencies
- Composition rules (extends, aspects, expansions)
- Bond points for external composition
To inspect the structure of an individual primitive (e.g. LoopSpec, Gate)
rather than a user-authored formula, use 'bd formula schema &lt;primitive&gt;'.
Examples:
bd formula show shiny
bd formula show rule-of-five
bd formula show security-audit --json
```
bd formula show <formula-name> [flags]
```