Skip to content

feat(hooks): pass rich context to JS/TS function hooks #292

@BryanFRD

Description

@BryanFRD

Summary

When using ferrflow.ts or ferrflow.js configs (#21), function hooks currently receive a basic context object with version and package info. The context should be enriched with additional release data to enable more powerful automation.

Current context (from FERRFLOW_* env vars)

{
  package: string;
  oldVersion: string;
  newVersion: string;
  bumpType: string;
  tag: string;
  dryRun: boolean;
  packagePath: string;
  channel: string | null;
  isPrerelease: boolean;
}

Proposed additions

Depending on the hook point, the context should include:

Post-bump / pre-commit

  • changelog: the generated changelog section for this release (markdown string)
  • bumpedFiles: list of versioned files that were updated (paths + formats)
  • commits: list of conventional commits included in this release (message, hash, type, scope, breaking)

Pre-publish / post-publish

  • releaseUrl: URL of the GitHub/GitLab release (post-publish only)
  • releaseNotes: the release notes body
  • assets: list of release assets if any

All hooks

  • monorepo: boolean indicating if this is a monorepo release
  • allPackages: in monorepo mode, list of all packages being released in this batch (name, version, bump)

Use cases

  • Post-bump: automatically update a RELEASES.md summary, notify Slack with changelog
  • Pre-commit: validate changelog content, run custom linting on bumped files
  • Post-publish: trigger downstream CI, update a dashboard, send release announcement with full context
  • Custom changelog: use the commits list to generate a custom changelog format

Implementation notes

  • New env vars (FERRFLOW_CHANGELOG, FERRFLOW_COMMITS_JSON, etc.) for shell hooks
  • JS/TS function hooks receive the same data as object properties
  • The HookContext struct in src/hooks.rs needs to be extended
  • Context population in src/monorepo.rs needs to pass the additional data at each hook point

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementImprovement to existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions