V3.0.1 alpha updates#4
Draft
ttschampel wants to merge 16 commits into
Draft
Conversation
Contract refs now carry the repo namespace (Go-module form) so cross-repo
references like CONTRACT:github.com/willackerly/rebar:S1-STEWARD.1.0 are
unambiguous, and a foreign-namespace ref in source is an immediate
signal of an upstream dependency.
- new `rebar contract migrate-namespace [--write]` infers the namespace
from `git remote get-url origin`, rewrites titles + source headers +
shell comment headers idempotently, writes `contract_namespace` to
.rebarrc, and regenerates CONTRACT-REGISTRY.md
- filenames stay unprefixed (CONTRACT-S1-STEWARD.1.0.md); the path
already namespaces by repo, and colons/slashes in filenames break
tooling
- enforcement scripts switch to dual-mode parsing: legacy refs still
work in unmigrated repos, but a repo with `contract_namespace` set
enforces strict namespaced form and flags bare refs as
MISSING-NAMESPACE
- templates/project-bootstrap synced so new repos via `rebar new` get
the namespaced form from day one
- rebar self-migrated to github.com/willackerly/rebar; second dry-run
reports no drift (idempotent)
Branch names keep the bare ID by design — `/` and `:` are problematic
in git refs on Windows, and the repo context is implicit in the branch.
feat(rebar): repo-namespace contract IDs + migrate-namespace command
…g repos Third-party adopters now get frictionless setup with 65% fewer top-level files. Projects reference versioned framework scripts instead of copying them, enabling multi-version coexistence and auto-propagating fixes. **Core changes:** - Versioned framework install (~/.rebar/versions/<ver>/) — projects pin via .rebar-version, multiple versions coexist - Adopting repos NO LONGER copy scripts/ (22 files removed from templates/project-bootstrap/) — enforcement runs from framework - Tier-aware audit — Tier 1 minimal checks (.rebarrc + TODO.md), Tier 2+ layer on (QUICKCONTEXT, AGENTS, agents/), no penalty for missing higher-tier artifacts - Auto-install .git/hooks/pre-commit during rebar init/adopt — symlink to framework's pre-commit.sh, merge logic for existing hooks - Auto-copy agents/subagent-guidelines.md from framework **New:** - cli/cmd/upgrade.go — goose-style migration orchestrator (rebar upgrade <version>) - cli/internal/hooks/ — hook install + merge (husky/pre-commit-py detection) - templates/project-bootstrap/agents/ — subagent-guidelines.md + README.md **Modified:** - cli/internal/config/config.go — RebarFrameworkDir, findRebarDir() (precedence: REBAR_DIR env → .rebar-version lookup → current symlink) - cli/cmd/init.go — removed scripts/ copying, added hook + guidelines install, rewrote findRebarRoot() to walk from exe path - cli/cmd/adopt.go, cli/cmd/new.go — same - cli/cmd/audit.go — readTier(), tier-conditional auditStructure/ Enforcement/Agents, skip weight-0 sections in output - setup-rebar.sh — versioned install to ~/.rebar/versions/<ver>/, updates current symlink **Deleted:** - templates/project-bootstrap/scripts/ — 22 files, 3247 lines removed **Adopting repo footprint (Tier 1):** Before: ~35 files (scripts/, full docs) After: ~12 files (.rebarrc, TODO, architecture/, agents/, hook) Reduction: 65% **Tested:** Tier 1 project audit 7.3/10, no scripts/, hook installed, subagent-guidelines copied, no Tier 3 penalty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(rebar): versioned framework + tier-aware audit + minimal adoptin…
chore(ci): add release workflows
Automatically initialize .rebar/ directory structure (repo ID, salt, manifest) when running `rebar adopt` or `rebar new`. Users no longer need to manually run `rebar init` after setup. Changes: - cli/cmd/adopt.go: call runInit() after scaffolding - cli/cmd/new.go: call runInit() after scaffolding - setup-rebar.sh: clarify new vs adopt usage in next steps - bin/rebar: rebuild with auto-init changes Simplifies onboarding flow from 3 steps to 1: - Before: install → adopt/new → init (manual, often forgotten) - After: install → adopt/new (init automatic)
Binary is build artifact, shouldn't be tracked. With new release automation: - Branch installs build from source (install_from_source) - Release installs use prebuilt binary (download_release) Added bin/rebar to .gitignore.
Enables bidirectional conversion between REBAR contracts and standard
specification formats (Gherkin, Mermaid, OpenAPI, JSON Schema).
Commands:
- rebar spec export: contracts → standard formats (specs/)
- rebar spec import: standard formats → contracts (architecture/)
- rebar spec sync: bidirectional sync with conflict detection
Features:
- Auto-extraction from contract sections and code blocks
- Manifest-based change tracking (.spec-manifest.json)
- Checksum validation for sync operations
- Support for multiple formats per contract
Supported formats:
- Gherkin (.feature): behavior scenarios
- Mermaid (.mmd): architecture diagrams
- OpenAPI (.yaml): API contracts
- JSON Schema (.json): data models
Directory structure:
specs/
gherkin/ *.feature
mermaid/ *.mmd
openapi/ *.yaml
schemas/ *.json
.spec-manifest.json
Enables interoperability with aider, cursor, and other agentic frameworks.
Three scan paths caused rebar to pick up files outside the consumer repo (framework install, .direnv caches, vendored deps), producing false positives. - runner.go: Run/RunPassthrough now take repoRoot as working directory instead of scriptsDir/.., and accept env vars (REBAR_CONTRACT_NAMESPACE, REBAR_TIER) so scripts resolve config from the consumer repo - contract_migrate.go: scanSourceDirs uses git ls-files instead of hardcoded directory list - audit.go: countSkippedTests/countContractHeaders use git ls-files - adopt.go: gatherCodebaseSummary uses git ls-files - repo/tracked.go: centralized TrackedFiles/TrackedFilesGrep helpers
…ystem Test suite (28/28 passing): - parser_test.go: contract parsing, section/code block extraction - export_test.go: full export, single format, dry-run (3 tests) - import_test.go: spec->contract generation, force overwrite, dry-run (3 tests) - sync_test.go: bidirectional sync scenarios (5 tests) - manifest_test.go: checksum tracking, change detection (6 tests) Test fixtures: - testdata/CONTRACT-AUTH.1.0.md: full contract with Gherkin, Mermaid, OpenAPI, JSON Schema - testdata/sample.feature: Gherkin for import testing Plugin architecture: - plugin.go: FormatPlugin interface, PluginRegistry, built-in implementations - plugins/: individual format handlers (gherkin, mermaid, openapi, jsonschema) - Extensible design for adding new formats (Protobuf, TypeSpec next) - Clean separation of extract/generate/detect logic per format Fixes: - Gherkin extraction: two-pass section matching to avoid ambiguous matches - First pass: exact matches (Scenarios, Behavior) - Second pass: partial matches, excluding Testing section - Fixes non-deterministic map iteration causing intermittent test failures - JSON Schema extraction: validate $schema presence - Sync checksum: fixed repoRoot path resolution in HasSpecChanged - Test isolation: use strings.Contains instead of custom substring search TODO.md added with roadmap: - Priority 1: Protobuf plugin (gRPC, message serialization) - Priority 2: TypeSpec plugin (protocol-agnostic IDL) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
fix: scope CLI scans to consumer repo boundaries
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
This PR adds comprehensive release automation and version management infrastructure to rebar, plus merges the versioned framework and repo-namespace features from upstream.
Key changes:
Release Automation
GoReleaser (.goreleaser.yml):
-ldflagsRelease Please (.github/workflows/release-please.yml):
.rebar-version+ manifest automaticallyPR Validation (.github/workflows/pr-title.yml):
Version Management
CLI version (cli/cmd/root.go):
Versionvar injected via ldflags:-X github.com/willackerly/rebar/cli/cmd.Version=vX.Y.Z"dev"for local buildsInstaller (setup-rebar.sh):
vX.Y.Z) vs branches~/.rebar/versions/<version>/Merged Features
Resolved conflicts merging:
cli/internal/config/config.goAccepted script deletions from base (old enforcement scripts removed).
Version Baseline
v3.0.1-alphaat commit775d382v3.0.1-alpha(in .rebar-version + .release-please-manifest.json)Installation
From release tag (prebuilt binary):
curl -fsSL https://raw.githubusercontent.com/ttschampel/rebar/v3.0.2-alpha/setup-rebar.sh | bash -s -- v3.0.2-alphaFrom branch (build from source):
curl -fsSL https://raw.githubusercontent.com/ttschampel/rebar/v3.0.1-alpha-updates/setup-rebar.sh | \ REBAR_REPO=https://github.com/ttschampel/rebar.git bash -s -- v3.0.1-alpha-updatesTesting
rebar version)Contracts