registry: improve push UX and unify pattern model#99
Merged
Conversation
Consolidate the Orkestra registry CLI around a single "pattern" mental model (rather than treating katalogs specially). Motifs and katalogs are pushed the same way and the code is now extensible to future pattern kinds. - Allow `ork registry push <dir>` (no tag) to default to the pattern's metadata.name:metadata.version from the primary file. - Enforce tag uniformity: when a tag is provided, it is validated against metadata.version. If metadata.version is empty the tag is adopted. - Respect user intent: `--force` overrides metadata.version with the provided tag; `--update-meta` optionally persists the overridden metadata.version back to the primary YAML file. - Keep the registry/document consistent by ensuring the pushed ref and the pattern metadata agree. - Add a small YAML write-then-format helper so persisted changes are written and formatted consistently. Tests and tooling: - Add unit tests for `ExtractTagVersion` covering registry refs, digests, ports and edge cases. - Add unit test for `persistMetadataVersion` using a temporary directory. - Add simple YAML formatting helper used by persist logic. This change improves safety by warning on mismatches while giving users the autonomy to override and persist changes when they explicitly ask for it.
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
Consolidate the Orkestra registry CLI around a single pattern mental model so motifs and katalogs are pushed the same way and future kinds can be handled uniformly.
Key behaviours introduced:
ork registry push <dir>now defaults tometadata.name:metadata.versionfrom the pattern primary file when no tag is supplied.metadata.version. Ifmetadata.versionis empty the tag is adopted.--forceallows the user to overridemetadata.versionwith the provided tag.--update-metaoptionally persists the overriddenmetadata.versionback to the primary YAML file (write → format).ExtractTagVersionandpersistMetadataVersion.This improves safety by warning on mismatches while giving users explicit control to override and persist changes.
Registry push test checklist
ork registry push ./patterns/postgres— usesmetadata.name:metadata.versionand pushes successfully.ork registry push postgres:v1 ./patterns/postgres— matching tag; no warnings; push succeeds.ork registry push postgres:v2 ./patterns/postgres— mismatched tag; fails and suggests--force.ork registry push --force postgres:v2 ./patterns/postgres— warns, push succeeds; file unchanged.ork registry push --force --update-meta postgres:v2 ./patterns/postgres— warns, file updated/formatted, push succeeds.Migration notes
metadata.version, consider updating scripts to use--forceor update the pattern files to match.