Skip to content

V3.0.1 alpha updates#4

Draft
ttschampel wants to merge 16 commits into
willackerly:v3.0.1-alphafrom
ttschampel:v3.0.1-alpha-updates
Draft

V3.0.1 alpha updates#4
ttschampel wants to merge 16 commits into
willackerly:v3.0.1-alphafrom
ttschampel:v3.0.1-alpha-updates

Conversation

@ttschampel

@ttschampel ttschampel commented May 22, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Complete release automation via Release Please + GoReleaser
  • Version injection via ldflags (no hardcoded versions)
  • Enhanced installer supporting both prebuilt binaries and source builds
  • Resolved rebase conflicts merging versioned framework + contract namespace features

Release Automation

GoReleaser (.goreleaser.yml):

  • Multi-platform binary builds (darwin/linux/windows, amd64/arm64)
  • Archives include full framework (binary + templates + scripts + agents)
  • Version injected at build time via -ldflags

Release Please (.github/workflows/release-please.yml):

  • Monitors conventional commits on main + feature branches
  • Auto-creates release PRs with changelog + version bumps
  • Updates .rebar-version + manifest automatically
  • Creates GitHub Release + tag when PR merged

PR Validation (.github/workflows/pr-title.yml):

  • Enforces conventional commit format on PR titles
  • Supports squash merge workflow

Version Management

CLI version (cli/cmd/root.go):

  • Version var injected via ldflags: -X github.com/willackerly/rebar/cli/cmd.Version=vX.Y.Z
  • Defaults to "dev" for local builds
  • No hardcoded versions

Installer (setup-rebar.sh):

  • Detects release tags (vX.Y.Z) vs branches
  • Release tags → downloads prebuilt binary from GitHub Releases
  • Branches → clones repo + builds from source with version injection
  • Supports versioned installs in ~/.rebar/versions/<version>/

Merged Features

Resolved conflicts merging:

  • Versioned framework (RebarFrameworkDir, findRebarDir helper)
  • Repo-namespace contracts (ContractNamespace field, readRebarRCString helper)
  • Both features now coexist in cli/internal/config/config.go

Accepted script deletions from base (old enforcement scripts removed).

Version Baseline

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-alpha

From 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-updates

Testing

  • Installer tested with branch build
  • Version injection verified in CLI (rebar version)
  • GoReleaser config validated
  • Release Please workflow runs successfully
  • Full release cycle (pending PR merge)

Contracts

  • No contract impact (infrastructure + build tooling only)

ttschampel and others added 16 commits May 15, 2026 11:39
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…
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
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.

2 participants