Skip to content

CLI 0.16.0: automations triggers ensure-brew-event (brew-v2#2071) - #57

Merged
thedogwiththedataonit merged 3 commits into
mainfrom
claude/brew-event-triggers
Oct 15, 2026
Merged

thedogwiththedataonit merged 3 commits into
mainfrom
claude/brew-event-triggers

Conversation

@thedogwiththedataonit

@thedogwiththedataonit thedogwiththedataonit commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

GetBrew/brew-v2#2071 adds Brew events: triggers Brew starts itself. The first is a contact unsubscribing. GetBrew/typescript-sdk#66 exposes it as triggers.ensureBrewEvent, and this adds the command:

brew-cli automations triggers ensure-brew-event --scope domain --domain-id jd7f0c2a8w1x9m4n6p3q5r8s2t
brew-cli automations triggers ensure-brew-event --scope all
  • Get or create: it returns the brand's trigger for that scope and prints the row with created. The same scope always prints the same row.
  • Flags: --event defaults to contact.unsubscribed, the only Brew event so far. --idempotency-key makes a retry replay, since the route's x-brew-idempotency is replay.
  • Usage errors (exit 2, no request sent): a missing or unknown --scope, --scope domain without --domain-id, and --domain-id with --scope all.
  • Generated files: the bundled spec and generated types now carry provider: "brew_event", brewEvent, source: "brew_event" and TRIGGER_NOT_FIREABLE. The command reference is regenerated.

Why draft

This needs @brew.new/sdk ^12.2.0 (typescript-sdk#66), which is not on npm yet, so tsc and parity-sdk fail in CI against the published 12.1.0. Once 12.2.0 publishes:

  1. Run bun add @brew.new/sdk@^12.2.0 and commit package.json + bun.lock.
  2. Mark this ready.

Release order: brew-v2#2071 deployed → docs → SDK 12.2.0 → this CLI.

Spec vendoring

openapi/public-api-v1.yaml is this repo's main copy plus exactly brew-v2#2071's spec diff, byte-identical to typescript-sdk#66's. The consent-source integration change that brew-v2 main also has stays with #51.

Validation

Run locally with node_modules/@brew.new/sdk swapped for the SDK PR's 12.2.0 build. That swap is local only; package.json still says ^12.1.0.

  • TDD: tests/commands/automations-brew-event-triggers.test.ts failed first and now passes. It covers the domain and all bodies, the idempotency key, four usage errors with no request, and 422 DOMAIN_PURPOSE_NOT_ALLOWED → exit 1.
  • bun run tsc, bun run lint, bun run test (557 tests, including parity-sdk, parity-spec and idempotency-flags), bun run docs:commands:check and bun run build pass.
  • node scripts/generate-types.mjs makes no changes to the committed types.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

RetriggerView in GreptileConfidence Score: 5/5

The changes since the previous review appear safe to merge, with no new blocking issue found.

Summary

Adds automations triggers ensure-brew-event for unsubscribe triggers.

  • The CLI can get or create Brew’s contact-unsubscribe trigger.

No new actionable issues were found in the changes since the previous review. Tests were not run; dependencies are not installed locally.

Reviews (2) · Last reviewed commit: "Depend on @brew.new/sdk ^12.2.0 (trigger..." · Reviewed by Greptile

thedogwiththedataonit and others added 2 commits October 14, 2026 08:56
GetBrew/brew-v2#2071 adds triggers Brew starts itself, the first being a
contact unsubscribing. GetBrew/typescript-sdk#66 exposes them as
`triggers.ensureBrewEvent`. This adds the command:

- `brew-cli automations triggers ensure-brew-event --scope domain
  --domain-id <id>` or `--scope all` gets or creates the brand's trigger
  for that scope and prints the row with `created`. `--event` defaults to
  `contact.unsubscribed`. Scope/domain mistakes exit 2 before any request,
  and `--idempotency-key` replays a retry.
- The bundled spec takes exactly brew-v2#2071's spec change; the
  consent-source sync stays with #51. Generated types and the command
  reference are regenerated.

Needs @brew.new/sdk ^12.4.0. Until that is on npm, typecheck and parity
fail in CI. Once it publishes: `bun add @brew.new/sdk@^12.4.0`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The SDK PR now releases as 12.2.0 (the next free version).
- Vendored spec delta from brew-v2#2071 (Brew-event test runs lay passed
  fields over Brew's sample; unsubscribe.reasons is required). Types
  regenerated.
- SKILL.md counts 145 commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thedogwiththedataonit
thedogwiththedataonit marked this pull request as ready for review October 15, 2026 08:20
@greptile-apps

greptile-apps Bot commented Oct 15, 2026

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Backup spec gives conflicting examples openapi/public-api-v1.yaml.orig:38748 ▶

    openapi/public-api-v1.yaml.orig adds a second 67,829-line spec that already disagrees with the real spec: unsubscribe.reasons is optional here but required in openapi/public-api-v1.yaml. The type generator reads only the latter, so the backup adds misleading examples and unnecessary maintenance work. Remove the backup file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thedogwiththedataonit
thedogwiththedataonit merged commit 2213a20 into main Oct 15, 2026
2 checks passed
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