Skip to main content

Unified, code-addressable rule registry + named presets for the Galaxy tool refactoring tiers — tier 3.6, a library-first facade the CLI (and a future MCP server) compose.

Project description

galaxy-tool-refactor-registry

The rule-registry facade (tier 3.6) of the Galaxy tool refactoring framework: a single, code-addressable view over every baked-in rule across the three rule families — codemod (tier 2, structural GTR), fmt (tier 3, cosmetic GTR), and check (tier 3.5, advisory) — plus named rulesets and per-rule enable/disable, behind a library-first API.

                 galaxy-tool-refactor-registry   (this package, tier 3.6)
                        ↑                       ↑
   galaxy-tool-refactor-cli (tier 4)     galaxy-tool-refactor-mcp (tier 4, future)

It depends on the rule tiers (0.5 / 1 / 2 / 3 / 3.5); the lower tiers do not depend on it. It is the orchestration core the galaxy-tool-refactor CLI sits on top of, and the core the agent-facing MCP server sits on (galaxy-tool-refactor-mcp). All XML serialisation goes through fmt, preserving "fmt is the only tier that writes/serialises XML".

Why library-first

No click / sys.exit / printing in the call path; functions take a path, raw bytes, or a ToolDocument and return structured results; files are written only when a write_path is given; and the rule/ruleset catalogs are introspectable (list_rules() / list_rulesets()). That shape lets both the CLI and a future agent-facing MCP server be thin adapters over the same core. See ../galaxy-tool-refactor-mcp/docs/vision.md.

Rulesets

Ruleset Contents Notes
cosmetic fmt cosmetic rules (GTR001/003/004) whitespace / indent / shorthand only
default (default) canonical codemods (GTR006/002/005/013) + cosmetic today's format — the opinionated formatter
iuc mirrors default (placeholder) reserved for an IUC-specific divergence
strict default + advisory checks format + flag everything IUC cares about (report-only)

Membership is declared per rule (RuleMeta.rulesets): the registry derives each ruleset's code set by grouping every registered rule by the names in its meta.rulesets. Adding or changing rules and rulesets is a developer task — there are no user-defined rules or rulesets.

Selection

resolve_codes(rulesets=…, select=…, ignore=…) turns ruleset names plus --select/--ignore code lists into a concrete code set — the base is the union of the named rulesets (or the default ruleset when none are named). Precedence is ruff-style: --ignore--select--ruleset — an explicit --select replaces the rulesets' set, then --ignore subtracts. Unknown ruleset names / rule codes raise the typed UnknownRuleset / UnknownRuleCode.

Public API (by submodule import; no re-exports)

from galaxy_tool_refactor_registry.facade import (
    run, upgrade, detect, list_rulesets, list_rules,
)
from galaxy_tool_refactor_registry.resolve import resolve_codes, resolve_upgrade_codes
from galaxy_tool_refactor_registry.registry import by_code, known_codes, advisory_codes
  • run(source, *, codes, write_path=None) -> FormatResult — apply the fixable rules in the selection (codemods in canonical order, then cosmetic fmt), reporting advisory findings as notes.
  • upgrade(source, *, codes, write_path=None) -> UpgradeResult — profile-upgrade plus the selected fixable rules.
  • detect(source, *, codes) -> DetectResult — report-only over the selection.
  • by_code(code) -> RuleHandle — the uniform, callable handle for one rule (meta, family, fixable, detect(document), apply(document) or None).

Develop

Run from the workspace root (galaxy-tool-refactor/):

uv run --package galaxy-tool-refactor-registry pytest galaxy-tool-refactor-registry/tests/
uv run ruff check galaxy-tool-refactor-registry/src galaxy-tool-refactor-registry/tests
uv run mypy --config-file galaxy-tool-refactor-registry/pyproject.toml galaxy-tool-refactor-registry/src

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galaxy_tool_refactor_registry-0.3.7.tar.gz (130.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galaxy_tool_refactor_registry-0.3.7-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

Details for the file galaxy_tool_refactor_registry-0.3.7.tar.gz.

File metadata

File hashes

Hashes for galaxy_tool_refactor_registry-0.3.7.tar.gz
Algorithm Hash digest
SHA256 efb282f1f266258ddd3f30c09a71d5ccc166d6dd296d7d58803ee5612b729418
MD5 2efca26e84a717709f52930f5807801c
BLAKE2b-256 4e288c28ec8329b78ccbc38a7f0f212aaab6a727f4163d687e817e513b2cfd36

See more details on using hashes here.

Provenance

The following attestation bundles were made for galaxy_tool_refactor_registry-0.3.7.tar.gz:

Publisher: release.yml on richard-burhans/galaxy-tool-refactor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file galaxy_tool_refactor_registry-0.3.7-py3-none-any.whl.

File metadata

File hashes

Hashes for galaxy_tool_refactor_registry-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1ec6c750b495aaaa906ca8e89f3861418610fb48841111f26abe2ae8694eace4
MD5 4df723c3e1e633bdc71741fe77e27e51
BLAKE2b-256 9db94f5f0efb1012c6812130a2c071f67ab46b5139485d8417c064bdfb544699

See more details on using hashes here.

Provenance

The following attestation bundles were made for galaxy_tool_refactor_registry-0.3.7-py3-none-any.whl:

Publisher: release.yml on richard-burhans/galaxy-tool-refactor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page