Skip to content

feat(release): implement release-context and decouple context generation#2

Merged
JacksonFergusonDev merged 2 commits intomainfrom
feat/release-context
May 2, 2026
Merged

feat(release): implement release-context and decouple context generation#2
JacksonFergusonDev merged 2 commits intomainfrom
feat/release-context

Conversation

@JacksonFergusonDev
Copy link
Copy Markdown
Owner

Overview

This PR introduces the focal release-context command, designed to extract high-signal repository changes for LLM-assisted release note synthesis.

Unlike strict changelog generators (e.g., git-cliff), this pipeline feeds the LLM the human-authored intents of merged PRs, strictly excluding raw code diffs and automated dependency bumps to maximize attention window efficiency.

Architectural Changes

  • Context Decoupling: Hoisted the context generation logic out of libexec/context and into lib/core.sh as generate_project_context(). This resolves a pipeline quirk where output_and_copy would overwrite the clipboard prematurely if invoked as a subshell $().
  • GitHub CLI Query Optimization: The new release-context bash wrapper dynamically resolves the temporal boundary (latest tag to HEAD) and passes it to the gh CLI. The query strictly excludes app/renovate, dependabot, and github-actions authors to prevent massive upstream changelogs from polluting the LLM's context window.
  • Python Formatter (gh_release_context.py): * Parses the JSON payload from gh.
    • Executes a regex pass (``) to scrub dead HTML comments injected by platform UIs or bots.
    • Formats the output with clear structural boundaries (PR Number, Author, Labels, URL, Intent).
  • Payload Composition: The bash wrapper concatenates the macroscopic repository blueprint (focal context) with the PR timeline, giving the LLM a complete understanding of both the system state and the delta.

Validation

  • Tested against a local repository with active tags.
  • Verified that dependency bumps and bot-authored PRs are entirely excluded from the payload.
  • Verified that focal context still operates correctly as a standalone command.

Decouples the repository context generation from the clipboard extraction pipeline. The logic from `libexec/context` has been migrated to `lib/core.sh` as `generate_project_context()`.

This prevents the `output_and_copy` function from hijacking stdout when context generation is composed inside other commands, allowing tools like `release-context` to safely prepend the project blueprint to their payloads without overwriting the system clipboard twice.
Introduces `focal release-context`, a new extractor that fetches all PRs merged since the most recent Git tag and formats them into an LLM-optimized markdown document.

- Automatically resolves the temporal boundary via `git log` and tags.
- Uses `gh` to fetch high-signal PR metadata (title, body, author, labels).
- Aggressively filters out standard bot accounts (Renovate, Dependabot, GitHub Actions) at the query level to preserve token bandwidth.
- Strips hidden HTML comments (e.g., ) from PR bodies.
- Prepends the macroscopic project context (tree, git status, manifests) to anchor the LLM's understanding of the repository architecture.
@JacksonFergusonDev JacksonFergusonDev merged commit adb8142 into main May 2, 2026
4 checks passed
@JacksonFergusonDev JacksonFergusonDev deleted the feat/release-context branch May 2, 2026 23:46
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.

1 participant