Problem
hspt tasks list and hspt emails list return paginated, unfiltered results with no way to query by status, owner, direction, or date. Finding open tasks for a specific owner requires paginating through the entire task history — potentially thousands of records — and filtering client-side.
# What you'd want (doesn't exist upstream):
hspt tasks search --filter "hs_task_status=NOT_STARTED" --filter "hubspot_owner_id=77999105"
hspt emails search --filter "hs_email_direction=EMAIL" --sort "hs_timestamp:desc"
# What you have to do instead:
hspt tasks list --limit 100 # oldest-first, no status filter, repeat with --after...
Precedent
contacts search and deals search already use the HubSpot CRM Search API. The filter/sort infrastructure in internal/cmd/shared/ already handles all the heavy lifting:
ParseFilters() — parses --filter flags into SearchFilterGroup structs
ParseSort() — parses --sort flags into SearchSort structs
- Auto-converts ISO dates to Unix milliseconds
- Supports shorthand (
prop=val, prop>=val) and explicit operators (prop:BETWEEN:low:high)
Proposed API
# Tasks: open tasks for a specific owner
hspt tasks search --filter "hs_task_status=NOT_STARTED" --filter "hubspot_owner_id=77999105" --sort "hs_timestamp:asc" --limit 50 -o json
# Tasks: overdue tasks
hspt tasks search --filter "hs_task_status=NOT_STARTED" --filter "hs_timestamp<=2026-03-17" --sort "hs_timestamp:asc"
# Emails: outbound emails
hspt emails search --filter "hs_email_direction=EMAIL" --sort "hs_timestamp:desc" --limit 20
# Emails: by subject
hspt emails search --filter "hs_email_subject:CONTAINS_TOKEN:Dev Academy" --limit 10
Both commands accept --filter, --sort, --limit, --after, and --properties flags — identical to contacts search and deals search.
Implementation notes
Each new subcommand follows the contacts search pattern (internal/cmd/contacts/contacts.go:newSearchCmd):
- Add
newSearchCmd(opts) to the command's Register() function
- Accept the standard search flags
- Call
shared.ParseFilters() and shared.ParseSort()
- Call
client.SearchObjects(api.ObjectTypeTasks, req) / client.SearchObjects(api.ObjectTypeEmails, req)
- Render via
v.Render()
The implementation is primarily wiring — no new infrastructure needed.
Problem
hspt tasks listandhspt emails listreturn paginated, unfiltered results with no way to query by status, owner, direction, or date. Finding open tasks for a specific owner requires paginating through the entire task history — potentially thousands of records — and filtering client-side.Precedent
contacts searchanddeals searchalready use the HubSpot CRM Search API. The filter/sort infrastructure ininternal/cmd/shared/already handles all the heavy lifting:ParseFilters()— parses--filterflags intoSearchFilterGroupstructsParseSort()— parses--sortflags intoSearchSortstructsprop=val,prop>=val) and explicit operators (prop:BETWEEN:low:high)Proposed API
Both commands accept
--filter,--sort,--limit,--after, and--propertiesflags — identical tocontacts searchanddeals search.Implementation notes
Each new subcommand follows the
contacts searchpattern (internal/cmd/contacts/contacts.go:newSearchCmd):newSearchCmd(opts)to the command'sRegister()functionshared.ParseFilters()andshared.ParseSort()client.SearchObjects(api.ObjectTypeTasks, req)/client.SearchObjects(api.ObjectTypeEmails, req)v.Render()The implementation is primarily wiring — no new infrastructure needed.