Skip to content

Improve option pattern#21

Merged
Digital-Shane merged 4 commits into
mainfrom
improve-option-pattern
Apr 23, 2026
Merged

Improve option pattern#21
Digital-Shane merged 4 commits into
mainfrom
improve-option-pattern

Conversation

@Digital-Shane
Copy link
Copy Markdown
Owner

@Digital-Shane Digital-Shane commented Apr 22, 2026

This PR cleans up a mistake I made when I first approved extension support.

At the time, the quickest way to get the S3 extension working was to expose a few pieces of the root package that were really supposed to stay internal. That included things like the config type and some of the internal tree construction helpers. It worked, but it also meant extensions could depend on implementation details from the core package, which is not a great place to end up. It made the public API bigger than it needed to be, and it made future refactors a lot riskier because internal changes could accidentally turn into breaking API changes.

This change fixes that by introducing a real extension pattern instead of relying on leaked internals. The new path is built around Walker, WalkItem, and NewTreeFromWalker. Instead of reaching into the root package to recreate tree construction logic, an extension now just needs to describe how to get its root item and how to fetch children for a given item. The core package takes care of the rest, including filtering, max depth, traversal caps, expansion, progress callbacks, and final tree assembly.

I also updated the filesystem constructor and the S3 extension to use that same walker-based path. That let me move the internal config and builder types back to private scope again, which was the main goal here. Option still works for extensions, but it no longer depends on exposing internal config machinery just to make that possible.
So the big picture is pretty simple: extensions still have a clean way to plug into tree construction, but now they do it through a public API that was actually designed for extensions instead of depending on internals that happened to be exposed to make one use case work.

@Digital-Shane Digital-Shane merged commit 04006d8 into main Apr 23, 2026
1 check passed
@Digital-Shane Digital-Shane deleted the improve-option-pattern branch April 23, 2026 01:02
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.

1 participant