Skip to content

event based / watcher cli#56

Merged
etbyrd merged 5 commits into
mainfrom
jet/rfc2177-imap-idle
May 10, 2026
Merged

event based / watcher cli#56
etbyrd merged 5 commits into
mainfrom
jet/rfc2177-imap-idle

Conversation

@jetpham
Copy link
Copy Markdown
Contributor

@jetpham jetpham commented May 9, 2026

Summary

  • Add the existing email search endpoint to the OpenAPI spec and regenerate Node, Python, and Go clients.
  • Add primitive emails watch and primitive emails wait polling commands for filtered inbound email workflows.
  • Add CLI polling helper tests and refresh Python lock metadata.

Testing

  • Node generate, lint, typecheck, tests, and build
  • Python generate, ruff, basedpyright, tests, package build, and twine check
  • Go generate, gofmt, vet, tests, and build
  • Shared fixture tests for Node, Python, and Go

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 9, 2026

Greptile Summary

This PR adds an email search endpoint to the OpenAPI spec and regenerates the Node, Python, and Go clients, then builds two new CLI polling commands — primitive emails watch (continuous, table-first) and primitive emails wait (exit-after-N, JSONL-first) — on top of a shared emails-poll.ts helper that handles cursor advancement, deduplication, and query construction.

  • OpenAPI + generated clients: The email search endpoint with its full query-parameter set, facets, and response models is added to the spec; all three SDK clients are regenerated from it.
  • emails-poll.ts: Shared helper encapsulating fetchEmailSearchPage, collectNewAcceptedEmails, cursor encoding, and DSL query building; well-tested with unit tests covering query shape, deduplication, and flag normalization.
  • emails-watch / emails-wait: New CLI commands that poll the search API on a configurable interval; both share the same drain-then-sleep loop pattern, with watch defaulting to a human table and wait defaulting to JSONL.

Confidence Score: 5/5

Safe to merge; the new polling commands are well-structured and the generated SDK files are low-risk.

The changes are additive — new CLI commands, generated SDK clients, and a shared polling helper — with no modifications to existing behavior beyond a small emails-latest.ts refactor. The polling logic is straightforward and covered by unit tests. The only gap is that sleep duration is not clamped to the remaining deadline, which only matters when users explicitly combine a short deadline with a large custom interval.

No files require special attention; the deadline-overshoot note in emails-wait.ts and emails-watch.ts only affects non-default --interval usage.

Important Files Changed

Filename Overview
sdk-node/src/oclif/commands/emails-poll.ts New shared polling helper: builds search queries, manages cursor advancement, deduplicates with seenIds, and exposes sleep/fetch utilities used by both watch and wait commands.
sdk-node/src/oclif/commands/emails-wait.ts New emails wait command; sleep duration is not clamped to the remaining deadline, so a large --interval can cause the command to overshoot --timeout significantly.
sdk-node/src/oclif/commands/emails-watch.ts New emails watch command; same sleep/deadline overshoot issue as emails-wait.ts when --seconds and a large --interval are combined.
sdk-node/src/oclif/commands/emails-latest.ts Minor refactor: extracts formatHeader() helper and updates example strings from colon to space syntax; no behavioral change.
sdk-node/tests/oclif/emails-poll.test.ts New unit tests covering query building, cursor encoding, deduplication, and flag normalization for the polling helpers.
openapi/primitive-api.yaml Adds the email search endpoint definition with query parameters, response schema, and facet/highlight models to the OpenAPI spec.
sdk-node/src/api/generated/sdk.gen.ts Regenerated SDK client adding the searchEmails function; generated file, no manual changes.
sdk-python/src/primitive/api/models/email_search_result.py Generated Python model for the email search result type; no manual changes.

Reviews (2): Last reviewed commit: "Merge origin/main into jet/rfc2177-imap-..." | Re-trigger Greptile

@etbyrd etbyrd merged commit 2b4a735 into main May 10, 2026
10 checks passed
@etbyrd etbyrd deleted the jet/rfc2177-imap-idle branch May 10, 2026 23:31
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