beads/docs/cli-reference/hooks.md
Chris Sells de0200ff77 docs(emitter): Cobra-accurate usage lines, published global flags, MDX ESM guard
Three generated-content defects from the adversarial review, all
structurally invisible to the drift gate (generated-vs-generated):

- Usage lines now mirror Cobra's help template: a runnable command shows
  its UseLine, a command with subcommands shows '<path> [command]', both
  when both apply. Previously bare UseLine() stamped 'bd mol [flags]' on
  30 parent pages — a line the binary never prints.
- The generated CLI index publishes the Global Flags block; the binary
  prints it on every --help but no page carried it.
- docsmint neutralizes prose lines that Mintlify's prebuild would dedent
  into MDX ESM blocks (a line beginning 'export'/'import' outside a
  fence gets wrapped in a code span). This is why /cli-reference/mail
  returned HTTP 200 while rendering only a parse-error placeholder —
  reproduced, fixed, and covered by a planted-hazard test; fenced
  content stays verbatim.

Also rewords check-cli-docs-drift.sh's early-PASS message, which
asserted 'the supplied binary differs' as the cause when uncommitted
local edits produce the same result.

All 113 pages + docs/CLI_REFERENCE.md regenerated through the pipeline;
TDD'd in cmd/bd/help_all_test.go and tools/docsmint/docsmint_test.go.
Verified live: /cli-reference/mail renders real content, zero parse
errors; generate-cli-docs.sh --check, docsync, freshness, and
mint broken-links all pass on this tree.
2026-07-12 10:37:17 -07:00

2.4 KiB

title description
bd hooks Manage git hooks for beads integration

{/* AUTO-GENERATED: do not edit manually */}

Generated from bd help --doc hooks.

Install, uninstall, or list git hooks for beads integration.

The hooks provide:

  • pre-commit: Run chained hooks before commit
  • post-merge: Run chained hooks after pull/merge
  • pre-push: Run chained hooks before push
  • post-checkout: Run chained hooks after branch checkout
  • prepare-commit-msg: Add agent identity trailers for forensics
bd hooks [command]

bd hooks install

Install git hooks for beads integration.

By default, hooks are installed to .git/hooks/ in the current repository. Use --beads to install to .beads/hooks/ (recommended for Dolt backend). Use --shared to install to a versioned directory (.beads-hooks/) that can be committed to git and shared with team members.

Hooks use section markers to coexist with existing hooks — any user content outside the markers is preserved across installs and upgrades.

Installed hooks:

  • pre-commit: Run chained hooks before commit
  • post-merge: Run chained hooks after pull/merge
  • pre-push: Run chained hooks before push
  • post-checkout: Run chained hooks after branch checkout
  • prepare-commit-msg: Add agent identity trailers (for orchestrator agents)
bd hooks install [flags]

Flags:

      --beads    Install hooks to .beads/hooks/ (recommended for Dolt backend)
      --chain    Chain with existing hooks (run them before bd hooks)
      --force    Overwrite existing hooks without backup
      --shared   Install hooks to .beads-hooks/ (versioned) instead of .git/hooks/

bd hooks list

Show the status of bd git hooks (installed, outdated, missing).

bd hooks list [flags]

bd hooks run

Execute the logic for a git hook. This command is typically called by thin shim scripts installed in .git/hooks/.

Supported hooks:

  • pre-commit: Run chained hooks before commit
  • post-merge: Run chained hooks after pull/merge
  • pre-push: Run chained hooks before push
  • post-checkout: Run chained hooks after branch checkout
  • prepare-commit-msg: Add agent identity trailers for forensics

The thin shim pattern ensures hook logic is always in sync with the installed bd version - upgrading bd automatically updates hook behavior.

bd hooks run <hook-name> [args...] [flags]

bd hooks uninstall

Remove bd git hooks from .git/hooks/ directory.

bd hooks uninstall [flags]