feat: contract namespace reduce scripts in user repo adoption - #8
Open
ttschampel wants to merge 5 commits into
Open
feat: contract namespace reduce scripts in user repo adoption#8ttschampel wants to merge 5 commits into
ttschampel wants to merge 5 commits into
Conversation
setup-rebar.sh now accepts a version positional arg and installs to ~/.rebar/versions/<version>/ with a 'current' symlink. - Release tags (vX.Y.Z): download prebuilt binary from GitHub Releases, fall back to source build if no binary for this platform - Branches / dev refs: clone repo and build from source with version injected via ldflags - Multiple versions coexist; projects pin via .rebar-version - curl pipe: bash -s -- v3.0.0-beta.2
…d logic pre-commit.sh calls `rebar check --pre-commit`. ci-check.sh calls `rebar audit`. All enforcement logic lives in the rebar binary (sourced from the rebar installation), not in scripts copied into adopting repos. Adopting repos no longer carry embedded copies of rebar's check internals; upgrading rebar upgrades enforcement automatically without any script sync. Removed 23 scripts from templates/project-bootstrap/scripts/ that were duplicating logic from the rebar install. The two remaining entry-point scripts (pre-commit.sh, ci-check.sh) are the only surface adopting repos need to carry.
config.go: add ContractNamespace field, read from contract_namespace key in .rebarrc. Existing repos without the key are unaffected (zero value). steward.sh: replace literal CONTRACT:<id> grep with an extended-regex pattern that matches both legacy (CONTRACT:<id>.<v>) and namespaced (CONTRACT:<ns>:<id>.<v>) references. Repos in transition between forms are scanned correctly without any changes to source files. .rebarrc template: add contract_namespace as a commented-out example with an explanation of the legacy vs namespaced forms and when to use it. No migration required. Both reference forms remain valid indefinitely.
Both architecture/CONTRACT-TEMPLATE.md and
templates/project-bootstrap/architecture/CONTRACT-TEMPLATE.md updated:
- Title: CONTRACT-{NAMESPACE}:{NAME}.{MAJOR}.{MINOR}
- Naming comment: explains filename (unnamespaced) vs title vs in-source
reference, and when to use legacy vs namespaced form
- VERSIONING comment: superseded-by/supersedes use namespaced form
- Dependencies: example CONTRACT: ref uses {NAMESPACE}:{NAME}
- Implementing Files: adds in-source header comment example; grep uses
extended-regex pattern matching both legacy and namespaced forms
- Retirement: predecessor reference uses NAME + namespace-aware regex
- Companion File: filename example drops legacy C1-prefix
check --pre-commit now resolves the rebar installation via findRebarRoot() and runs check-todos.sh + check-contract-refs.sh from there directly. Project scripts/pre-commit.sh is a 7-line entry point only. This eliminates: - Circular chain: pre-commit.sh → rebar check → pre-commit.sh → ∞ - Enforcement logic in adoption repos (only entry point lives there) - Stale logic when rebar upgrades (rebar home scripts update automatically) Also fixes: - setup-rebar.sh: REBAR_REPO env now used as clone URL in source builds - init.go: findRebarRoot() marker changed to setup-rebar.sh (steward.sh was removed from templates/project-bootstrap/scripts/ in thin-scripts refactor, breaking framework detection for source installs) - init.go: bootstrapV2Files() log message reflects thin-scripts count
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
Contracts
Checklist
CONTRACT:header comment./scripts/check-contract-refs.sh)TODO:comments (./scripts/check-todos.sh)Test Plan