feat: pluggable materializer backends — --out --format#133
Merged
jamestexas merged 2 commits intomainfrom Mar 25, 2026
Merged
Conversation
Add Materializer interface with three backends so --out can write projected trees to formats other than SQLite: - SQLiteMaterializer: file copy (refactored from copyFile) - ZIPMaterializer: nodes → zip archive entries - BoltDBMaterializer: dirs → nested bbolt buckets (//go:build boltdb) New --format flag on root command (default: sqlite). 18 tests total, all TDD. [mache-65d237]
There was a problem hiding this comment.
Pull request overview
Adds a new internal/materialize package to make --out support multiple output backends, selected via a new --format CLI flag, while keeping SQLite as the default.
Changes:
- Introduces a
Materializerinterface plus aForFormatfactory (with build-tag gated registration for optional formats). - Implements SQLite (DB file copy), ZIP (file nodes → ZIP entries), and BoltDB (dirs → nested bbolt buckets;
//go:build boltdb) backends. - Updates
macheroot command--outflow to dispatch through the selected materializer and adds tests for SQLite/ZIP/factory + BoltDB behind the build tag.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
internal/materialize/materialize.go |
Defines the Materializer interface, format factory, and SQLite/ZIP implementations. |
internal/materialize/materialize_test.go |
Adds core tests for SQLite/ZIP materializers and the ForFormat factory. |
internal/materialize/boltdb.go |
Adds build-tagged BoltDB materializer implementation and registration. |
internal/materialize/boltdb_test.go |
Adds build-tagged tests covering BoltDB output structure and content. |
cmd/mount.go |
Adds --format flag and replaces direct DB copy in the --out flow with materializer dispatch. |
go.mod |
Adds go.etcd.io/bbolt dependency for the optional BoltDB backend. |
go.sum |
Adds checksums for the new bbolt dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Flag help text: note boltdb requires -tags boltdb - ForFormat error: build supported-format list dynamically - BoltDB: check os.Remove error (tolerate IsNotExist), use 0600 perms - Test comment: clarify node count breakdown [mache-65d237]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Materializerinterface +ForFormatfactory in newinternal/materialize/package//go:build boltdb)--formatflag on root command (sqlite|zip|boltdb, defaultsqlite)copyFile()in--outpath with materializer dispatchTest plan
boltdbbuild tagtask lint— 0 issuestask test— full suite greentask build— builds and codesignsBead: mache-65d237
🤖 Generated with Claude Code