Skip to main content

plugins Command

Manage BSG (Batho Structured Graph) plugins for semantic analysis and rule-based transformations.

Usage

batho plugins <subcommand> [options]

Subcommands

SubcommandPurpose
listList available BSG plugins
validateValidate a BSG plugin YAML file
testRun BSG plugin fixture tests
validate-strictValidate a plugin YAML with strict-mode (promotes warnings to errors)
traceInspect rule resolution and optionally apply rules with a trace log

plugins list

List all available BSG plugins in the repository.

batho plugins list --root /path/to/repo

Flags

FlagDefaultDescription
--rootrequiredPath to repository root
-v, --verboseoffShow detailed plugin information

plugins validate

Validate a BSG plugin YAML file against the schema.

batho plugins validate /path/to/plugin.yaml

Arguments

ArgumentRequiredDescription
plugin_fileYesPath to plugin YAML file to validate

plugins test

Run BSG plugin fixture tests using YAML give/expect files.

# Test all fixtures in a directory
batho plugins test --fixtures /path/to/fixtures --root /path/to/repo

# Test a single fixture file
batho plugins test --fixture /path/to/fixture.yaml --root /path/to/repo

# Output structured JSON
batho plugins test --fixtures /path/to/fixtures --json

Flags

FlagDefaultDescription
--fixturesnoneDirectory containing *.yaml fixture files
--fixturenonePath to a single fixture YAML file
--rootnoneOptional root path for file-content matchers
--jsonoffEmit structured JSON output instead of human summary

plugins validate-strict

Validate a plugin YAML file with strict-mode, which promotes warnings to errors.

batho plugins validate-strict /path/to/plugin.yaml

Arguments

ArgumentRequiredDescription
plugin_fileYesPath to plugin YAML file to validate

plugins trace

Inspect rule resolution and optionally apply rules with a trace log for debugging.

batho plugins trace --root /path/to/repo

Flags

FlagDefaultDescription
--rootrequiredPath to repository root

Plugin Schema

BSG plugins follow the schema defined in batho/bsg/schemas/bsg-plugin-schema-v1.json.

Example Plugin

version: bsg-plugin-v1
name: token-optimization
description: Optimize token usage for LLM context
rules:
- name: truncate-docstrings
entity_types: [function, method]
actions:
- type: truncate_docstring
max_length: 100
- name: normalize-entry-points
entity_types: [function]
name_patterns: [main, run, start]
actions:
- type: normalize_entry_point

Use Cases

  • Development: Validate custom plugins before deployment
  • Testing: Ensure plugin rules work as expected with fixture tests
  • Debugging: Use trace to understand rule resolution
  • CI/CD: Integrate validation into build pipelines