Skip to content

Initial#1

Merged
funkyshu merged 7 commits into
mainfrom
initial
Jul 4, 2026
Merged

Initial#1
funkyshu merged 7 commits into
mainfrom
initial

Conversation

@funkyshu

@funkyshu funkyshu commented Jul 4, 2026

Copy link
Copy Markdown
Member

No description provided.

funkyshu and others added 4 commits July 3, 2026 23:28
Extract prenup from the ep-tools monorepo into a standalone open-source
project at github.com/c2fo/prenup.

- Rename Go module to github.com/c2fo/prenup (dropping the /v2 path
  segment; version history resets to v0.1.0).
- Retarget the release version check at c2fo/prenup with a plain "v"
  tag prefix instead of the monorepo's "prenup/" prefix.
- Rewrite all C2FO/ep-tools URLs, install commands, and JSON Schema
  $id to the new repo location.
- Sanitize prenup.example.yaml to drop monorepo-specific tasks.
- Add open-source scaffolding modeled on c2fo/releasegen: LICENSE.md,
  CODE_OF_CONDUCT.md, .golangci.yml, .testcoverage.yml, ISSUE_TEMPLATE
  and CI workflows (ci, codeql, go-test-coverage, golangci-lint,
  validate-changelog). The releasegen release workflow follows c2fo/vfs
  and runs the published ghcr.io/c2fo/releasegen:v1 image.
- Add .releasegen.yaml so the validate and release workflows share one
  source of truth for changelog rules.
- Reset CHANGELOG.md to a single v0.1.0 entry summarizing current
  capabilities; drop internal-monorepo history and the v2 rewrite plan.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 4, 2026 22:21
@c2fo-cibot c2fo-cibot Bot added the size/XXL Denotes a PR that changes 1000+ lines label Jul 4, 2026
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the initial open-source release of Prenup, a Go-based Git pre-commit hook runner that discovers changed modules, executes configured tasks, and renders results in human, markdown, or NDJSON (JSON) formats.

Changes:

  • Add core runner, change/module discovery, and config/schema support for .prenup.yaml (v1).
  • Add CLI command tree (run, plan, install, uninstall, init, config validate/schema, version) plus hook installation/chaining.
  • Add UI output modes (TTY selection + summary, markdown/agent strings, NDJSON sink) and operational safeguards (repo lock, stash/restore, stage generated output).

Reviewed changes

Copilot reviewed 90 out of 93 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
SECURITY.md Adds security policy and vulnerability reporting guidance.
prenup.example.yaml Provides a commented example .prenup.yaml configuration.
LICENSE.md Adds MIT license text.
internal/versioncheck/versioncheck.go Implements GitHub Releases-based update check logic.
internal/ui/output.go Resolves auto output mode based on environment/TTY.
internal/ui/jsonout/jsonout.go Adds NDJSON sink for machine-readable runner events.
internal/ui/jsonout/jsonout_test.go Tests NDJSON sink behavior and bootstrap agent_hint.
internal/ui/human/summary.go Adds post-run human-readable summary sink.
internal/ui/human/selection.go Adds interactive Bubble Tea task selection UI.
internal/ui/agent.go Centralizes agent-facing stable strings and version labeling.
internal/ui/agent_test.go Pins agent-facing constants and VersionLabel behavior.
internal/runner/template.go Adds template variable expansion for commands/working dirs.
internal/runner/stage.go Implements staging of newly generated files with module scoping.
internal/runner/stage_test.go Tests stage-output behavior and module scoping rules.
internal/runner/multisink.go Adds fan-out sink to emit events to multiple sinks.
internal/runner/multisink_test.go Tests fan-out sink emit/close behavior.
internal/runner/mocks/mocks.go Adds generated mocks for runner interfaces.
internal/runner/exec.go Implements bash -c executor with streaming output and graceful cancel.
internal/runner/exec_test.go Tests executor behavior, env flattening, and cancellation.
internal/runner/events.go Defines runner event schema and sink interface contract.
internal/lock/lock.go Adds per-repo advisory lock to prevent concurrent runs.
internal/lock/lock_test.go Tests lock acquisition, contention, and concurrency behavior.
internal/lock/helpers_test.go Tests internal helpers for .git resolution and parsing.
internal/lock/flock_unix.go Implements flock-based locking for Unix platforms.
internal/hook/install.go Implements hook install/uninstall with replace/chain/force modes.
internal/hook/install_test.go Tests hook installation modes and uninstall restoration behavior.
internal/hook/exists_error_test.go Pins user-facing error message for existing hook conflicts.
internal/git/version_test.go Tests git version diagnostic contract.
internal/git/stash.go Implements stash push/pop with prenup-tagged messages.
internal/git/git.go Adds git wrapper for repo root, status, add, stash, etc.
internal/git/git_test.go Integration tests for git wrapper behaviors.
internal/discover/modules.go Implements module discovery via marker files.
internal/discover/discover_test.go Tests change filtering and module discovery behavior.
internal/discover/changes.go Implements changed-file discovery with exclude pattern support.
internal/discover/changes_test.go Integration tests for changed-file discovery and pattern validation.
internal/config/schema.json Adds canonical JSON schema for .prenup.yaml (v1).
internal/config/schema.go Embeds schema.json into the binary.
internal/config/schema_test.go Ensures embedded schema matches assets/prenup.schema.json.
internal/config/marshal_test.go Tests config marshal/parse round-trip and defaults.
internal/config/config_test.go Tests config parsing/validation rules and path safety checks.
internal/cli/versioncheck_test.go Tests version-check cancellation behavior.
internal/cli/version.go Adds resolved version logic with build-info fallback and test reset.
internal/cli/run_internal_test.go Tests run helper logic for discovery and selection behavior.
internal/cli/run_helpers_test.go Tests CLI helpers, flags parsing, token precedence, and repo lock.
internal/cli/root.go Adds root command wiring, default behavior, and version subcommand.
internal/cli/plan.go Adds plan command and JSON/text rendering of planned tasks.
internal/cli/plan_render_test.go Tests plan renderers for both text and JSON output.
internal/cli/install.go Adds install/uninstall commands and conflict resolution prompt.
internal/cli/install_helpers_test.go Tests install flag parsing and binary/mode resolution helpers.
internal/cli/init.go Adds init command to scaffold a starter .prenup.yaml.
internal/cli/init_test.go Tests init scaffolding behavior and repo-tailoring heuristics.
internal/cli/config_cmd.go Adds config validate and config schema subcommands.
internal/cli/config_cmd_test.go End-to-end tests for config validate/schema commands.
internal/cli/commands_metadata_test.go Validates cobra command metadata and expected flags/subcommands.
internal/cli/commands_integration_test.go Integration tests for install/plan/root execute behavior.
go.mod Defines module dependencies and Go toolchain version.
docs/SCHEMA.md Documents config schema and NDJSON event stream contract.
docs/FUTURE.md Captures future roadmap ideas and non-goals.
CONTRIBUTING.md Adds contributor setup, testing, style, and changelog guidance.
CODE_OF_CONDUCT.md Adds Contributor Covenant code of conduct.
cmd/prenup/main.go Adds main entrypoint delegating to CLI Execute.
CHANGELOG.md Adds initial unreleased changelog entries for the first release.
assets/prenup.schema.json Publishes schema asset intended to match embedded schema exactly.
.testcoverage.yml Configures go-test-coverage thresholds and exclusions.
.releasegen.yaml Configures ReleaseGen validation and change types.
.prenup.yaml Adds repo’s own prenup configuration (dogfooding).
.mockery.yaml Configures mockery generation for runner interfaces.
.golangci.yml Adds golangci-lint configuration and formatting rules.
.gitignore Adds ignores for build artifacts and coverage output.
.github/workflows/validate-changelog.yml Adds PR workflow to validate changelog updates.
.github/workflows/releasegen.yml Adds release workflow driven by changelog via ReleaseGen.
.github/workflows/golangci-lint.yml Adds golangci-lint workflow with module matrix.
.github/workflows/go-test-coverage.yml Adds coverage workflow with threshold enforcement.
.github/workflows/codeql.yml Adds CodeQL scanning workflow for Go.
.github/workflows/ci.yml Adds basic Go test CI workflow.
.github/ISSUE_TEMPLATE/feature_request.md Adds feature request issue template.
.github/ISSUE_TEMPLATE/custom.md Adds placeholder custom issue template.
.github/ISSUE_TEMPLATE/bug_report.md Adds bug report issue template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cli/config_cmd_test.go
Comment thread docs/SCHEMA.md
Comment thread internal/cli/plan.go
Comment thread internal/versioncheck/versioncheck.go
Comment thread internal/versioncheck/versioncheck.go
Comment thread internal/ui/jsonout/jsonout.go
Comment thread internal/ui/jsonout/jsonout.go
Comment thread internal/ui/agent.go
@funkyshu

funkyshu commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Addressed all 8 Copilot review comments in local commits (not yet pushed):

  • internal/cli/config_cmd_test.go:75 — Correct. config validate prints only path/version/task-count. Reworked the assertion to check the actual output shape (path, v1,, 1 tasks) instead of the task name.
  • docs/SCHEMA.md:66 — Correct. Updated the time row to say "Present on every runner event. Omitted from the bootstrap agent_hint line, which is a static self-describing header rather than a timestamped event."
  • internal/cli/plan.go:30 — Correct. prenup plan only supports text (default) and JSON. Changed the --output help to "output mode: text (default) or json".
  • internal/versioncheck/versioncheck.go:22 — Added ?per_page=100 to the Releases API URL with a comment explaining that we deliberately don't paginate on the pre-commit hot path.
  • internal/versioncheck/versioncheck.go:113 — Added formatRateLimitReset that parses the Unix seconds and renders resets in <duration> at <RFC3339 UTC time>, with a fallback for empty/malformed headers. Existing rate-limit test updated + a new TestFormatRateLimitReset truth-table covers the fallback.
  • internal/ui/jsonout/jsonout.go:4, :60, internal/ui/agent.go:12 — Fixed all three prenup/docs/SCHEMA.md references to the correct in-repo path docs/SCHEMA.md, including the agent-facing event_types_note string.

go test -race ./... clean, golangci-lint run ./... clean, coverage thresholds still pass. CHANGELOG updated with a ### Fixed block for the user-visible items.

Resolves the eight Copilot review comments on PR #1:
- internal/cli/config_cmd_test.go: assert against the actual `config
  validate` output shape (path, version, task count) instead of the task
  name, which the handler intentionally does not echo.
- internal/cli/plan.go: `--output` help no longer advertises unsupported
  `auto`/`human`/`markdown` modes; only `text` (default) and `json` are
  implemented.
- docs/SCHEMA.md: clarify that the `time` field is present on every
  runner event but omitted from the bootstrap `agent_hint` line, which
  is a static self-describing header rather than a timestamped event.
- internal/versioncheck/versioncheck.go: request the GitHub Releases API
  with `?per_page=100` so repos accumulating many releases (or non-
  semver tags) can't push the latest valid semver release off the first
  page. We deliberately do not paginate on this pre-commit hot path.
- internal/versioncheck/versioncheck.go: render the `X-RateLimit-Reset`
  header as an RFC3339 UTC time plus a "resets in <duration>", falling
  back to "reset time unavailable" on parse failure, instead of leaking
  the raw Unix epoch integer to operators. New TestFormatRateLimitReset
  covers the fallback branches; the existing rate-limit test asserts
  against the new format.
- internal/ui/agent.go, internal/ui/jsonout/jsonout.go: fix three
  `prenup/docs/SCHEMA.md` references (including the agent-facing
  `event_types_note` hint string) to the correct in-repo path
  `docs/SCHEMA.md`.
Copilot AI review requested due to automatic review settings July 4, 2026 22:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 89 out of 92 changed files in this pull request and generated 3 comments.

Comment thread internal/lock/lock.go
Comment thread internal/ui/human/summary.go
Comment thread internal/versioncheck/versioncheck.go
Copilot AI review requested due to automatic review settings July 4, 2026 22:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 89 out of 92 changed files in this pull request and generated 4 comments.

Comment thread internal/lock/lock.go Outdated
Comment thread internal/lock/lock.go
Comment thread internal/cli/run_helpers_test.go Outdated
Comment thread internal/lock/flock_unix.go
Resolves the follow-up Copilot review comments on PR #1:
- internal/lock/lock.go: correct the Acquire godoc, which incorrectly
  said Close removes the lock file (it intentionally does not, to avoid
  an unlink/unlock TOCTOU race).
- internal/lock/lock.go: resolve a relative `gitdir:` target in a `.git`
  file (worktrees/submodules) against repoRoot instead of the current
  working directory, so the lock lands in the real git metadata dir.
- internal/lock/flock_other.go: add a `!unix` build-tagged no-op flock
  stub so the package (and module) compiles on non-unix platforms.
  Advisory locking stays unix-only by design, as the package doc states.
- internal/ui/human/summary.go: bound the retained output buffer to the
  most recent maxSummaryLogLines lines (keeping a tail and reporting how
  many were dropped) so a noisy task can't grow memory without limit.
- internal/versioncheck/versioncheck.go: send a User-Agent header on the
  Releases API request; GitHub expects one and can 403 without it.
- internal/cli/run_helpers_test.go: drop a no-op strings.TrimSuffix(.,"")
  and return the buffer directly.
Adds tests for the relative-gitdir resolution and the summary log bound.
@funkyshu
funkyshu merged commit bef26d8 into main Jul 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants