Skip to content

Add WithTransformerFunc helper and improve docs discoverability#45

Merged
Azhovan merged 1 commit intomainfrom
feature/add-transformers-sytanx-sugar
Feb 25, 2026
Merged

Add WithTransformerFunc helper and improve docs discoverability#45
Azhovan merged 1 commit intomainfrom
feature/add-transformers-sytanx-sugar

Conversation

@asadijabar
Copy link
Collaborator

What

Add an ergonomic inline transformer registration helper and improve discoverability of related configuration features in the docs/examples.

This PR:

  • adds Loader.WithTransformerFunc(fn func(context.Context, *T) error) as a convenience wrapper over WithTransformer(TransformerFunc[T](fn))
  • adds a focused unit test for the new helper in loader_test.go
  • documents WithTransformerFunc(...) and preferred inline usage in docs/api-reference.md
  • updates the transformer example in README.md and examples/transformer/main.go to use the shorter syntax
  • improves README/docs navigation and anchors for common user paths (watch/reload status, common paths, deep-linkable quick-start sections)

Why

Inline typed transformers are a common use case, and the current syntax is verbose at call sites:

  • WithTransformer(rigging.TransformerFunc[T](func(...) ...))

The helper keeps the existing transformer API and semantics intact while making the common inline case easier to read and copy from docs/examples.

The docs changes make features like transforms, snapshots, watch/reload, and key-mapping semantics easier to discover from the README and quick-start pages.

Type

  • Fix
  • Feature
  • Docs
  • Performance
  • Breaking change

Testing

Executed:

gofmt -w loader.go loader_test.go
gofmt -w examples/transformer/main.go
go test ./...

Result:

  • go test ./... passed (including compile checks for examples/basic and examples/transformer)

Would run:

go vet ./...
make ci

Reason:

  • extra static/CI parity checks; not required to validate this additive helper and docs/example updates locally

Checklist

  • Tests pass (go test ./...)
  • Formatted (gofmt -s -w .)
  • No vet warnings (go vet ./...)
  • Coverage maintained (>70%)
  • Added tests if needed
  • Updated docs if needed

Notes:

  • Formatted changed Go files with gofmt -w (not repo-wide gofmt -s -w .)
  • Coverage was not measured in this change

For reviewers: Does this align with Rigging's philosophy of simplicity and zero dependencies?

Copilot AI review requested due to automatic review settings February 25, 2026 22:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a convenience helper WithTransformerFunc to reduce verbosity when registering inline transformers, and significantly improves documentation discoverability through strategic anchor additions and navigation tables.

Changes:

  • Adds Loader.WithTransformerFunc(fn func(context.Context, *T) error) as an ergonomic wrapper around the verbose WithTransformer(TransformerFunc[T](fn)) syntax
  • Updates transformer examples in README.md and examples/transformer/main.go to use the new concise syntax
  • Enhances documentation navigation with deep-linkable anchors in quick-start.md and configuration-sources.md, plus comprehensive navigation tables in README.md

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
loader.go Adds WithTransformerFunc convenience method that delegates to WithTransformer
loader_test.go Adds comprehensive unit test verifying chaining, registration, and execution of the wrapped transformer
examples/transformer/main.go Updates example to use the new WithTransformerFunc helper instead of verbose WithTransformer(TransformerFunc[...]) syntax
docs/api-reference.md Documents the new helper with example usage and recommends it for inline transforms
docs/quick-start.md Adds HTML anchors for deep-linking and standardizes heading capitalization
docs/configuration-sources.md Adds HTML anchors for improved documentation navigation
README.md Updates transformer example to use new helper and adds comprehensive navigation tables linking to documentation sections with new anchors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Azhovan Azhovan merged commit 8a173b6 into main Feb 25, 2026
9 checks passed
@github-actions github-actions bot deleted the feature/add-transformers-sytanx-sugar branch February 25, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants