Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/sentry

README.md

196 lines · 7.2 KB · Markdown

@kody/sentry

Intent

Headless Sentry utilities for Kody workflows — organizations, projects, issue search, event summaries, and agent-ready triage using a user-scoped sentryAuthToken secret. The low-level REST layer is a thin OpenAPI-scaffolded client (listorganizations, listorganizationprojects, listorganizationissues) plus a small escape-hatch request helper for endpoints missing from Sentry's public OpenAPI inventory (for example latest issue event). Writes through request default to dry-run.

This listing is meant to be forked. The live @kody/sentry package does not talk to a shared Sentry org. After you fork, save your own auth token and call the helpers in your account.

This official API-token package is the preferred invoke path. Setup is harder: save a user-scoped sentryAuthToken. For a faster first win, connect Sentry MCP in Get started and use @kody/sentry-mcp.

When To Use

  • List organizations or projects before querying issues
  • Search unresolved issues with optional latest-event summaries for triage
  • Inspect a specific issue, its events, or build a full triage bundle
  • Call uncommon Sentry REST endpoints via request (mutating calls default to dryRun)

Required setup

Auth is a bearer auth token (personal token, organization token, or internal-integration token). This is not OAuth by default and not a bot token. Do not paste the token into chat.

  1. Create a token in Sentry: User settings → Personal Tokens or an internal integration.
  2. Grant at least org:read, project:read, and event:read. Add event:write only if you will call mutating request paths.
  3. Save it as sentryAuthToken:

https://kody.codes/account/secrets/new?name=sentryAuthToken&description=Sentry%20auth%20token%20for%20organizations%2C%20projects%2C%20issues%2C%20and%20events&allowedHosts=sentry.io,us.sentry.io,de.sentry.io&scope=user

  1. Approve hosts sentry.io, us.sentry.io, and de.sentry.io on that secret. Saving the secret does not approve hosts by itself.
Optional BYO OAuth

Only if you already have a Sentry OAuth application. Redirect URI must be exactly https://kody.codes/connect/oauth. Do not register a new platform OAuth app for Kody.

https://kody.codes/connect/oauth?provider=sentry&authorizeUrl=https://sentry.io/oauth/authorize/&tokenUrl=https://sentry.io/oauth/token/&flow=confidential&pkce=true&scopes=org:read%20project:read%20event:read&allowedHosts=sentry.io,us.sentry.io,de.sentry.io&apiBaseUrl=https://sentry.io/api/0/&dashboardUrl=https://sentry.io/settings/account/api/applications/

After connect, pass integration: 'sentry' (or another saved integration name) on every call.

Multi-account

There are no hard-coded account aliases:

  • Token lane: pass secretName (default sentryAuthToken). Save a second token as sentryAuthTokenWork and pass secretName: 'sentryAuthTokenWork'.
  • OAuth lane: pass integration (for example 'sentry' or 'sentry-work').
Scopes and 403s
ScopeUsed for
org:readlist-organizations and org-scoped reads
project:readlist-projects, resolve-project
event:readissues and events
event:writemutating request paths (resolve/ignore/assign)

A 403 from this package names the missing likely scope and the next setup step (recreate the token with that scope, then update the secret). A 401 means the token is missing or invalid — reopen the secrets URL above.

Hosts

Default API host is sentry.io. Approve the host(s) you will call on that secret:

HostWhen to approve
sentry.ioDefault SaaS API host (start here)
us.sentry.ioUS data-storage region
de.sentry.ioEU data-storage region

Pass host on any export to target a region or self-hosted instance (host: "us.sentry.io" or host: "sentry.example.com"). Self-hosted hosts must be added to the secret's allowed hosts after save. Requests are always HTTPS.

Docs: Choosing the API base domain · Authentication

Exports

ExportDescription
.Package overview and import pattern
./list-organizationsOrganizations accessible to the token
./list-projectsProjects for an organization
./resolve-projectResolve a project by slug or numeric id
./search-issuesSearch issues (paginated, includeLatestSummaries)
./get-issueFetch one issue by id
./get-latest-issue-eventLatest event for an issue
./get-issue-eventsRecent events for an issue
./summarize-issue-eventSummarize an event, or the latest event by issueId
./triage-issueAgent-ready triage bundle
./requestGeneric Sentry REST call; writes default to dry-run
./smoke-testLocal host checks plus optional live org list

Default exports match the file name (./list-organizationslistOrganizations, ./requestsentryRequest, ./smoke-testsmokeTest).

Examples

Search unresolved issues:

import searchIssues from 'kody:@kody/sentry/search-issues'

const issues = await searchIssues({
  orgSlug: 'acme',
  query: 'is:unresolved',
  statsPeriod: '14d',
  limit: 5,
})

Triage one issue:

import triageIssue from 'kody:@kody/sentry/triage-issue'

const triage = await triageIssue({ issueId: '1234567890', recentEventLimit: 3 })

Preview a write, then apply only after confirmation:

import sentryRequest from 'kody:@kody/sentry/request'

const preview = await sentryRequest({
  path: '/issues/1234567890/',
  init: { method: 'PUT', body: JSON.stringify({ status: 'resolved' }) },
})
// => { dryRun: true, wouldCall: { method: 'PUT', path: '/issues/1234567890/', ... } }

const resolved = await sentryRequest({
  path: '/issues/1234567890/',
  init: { method: 'PUT', body: JSON.stringify({ status: 'resolved' }) },
  dryRun: false,
})

Forking

Community listings are snapshots. Fork this listing into your account, review the source, publish your copy, then save sentryAuthToken. Do not treat the live @kody/sentry package as bound to your org.

One-click listing URL after publish: https://kody.codes/@kody/sentry

Smoke test

./smoke-test always runs local host-normalization checks. When sentryAuthToken is saved it also lists organizations.

import smokeTest from 'kody:@kody/sentry/smoke-test'

export default async function main() {
  return await smokeTest()
}

Notes

  • Helpers project slim objects for triage. Use ./request when you need an unwrapped REST path.
  • GET / HEAD / OPTIONS always execute. Other methods on ./request default to { dryRun: true, wouldCall } until you pass dryRun: false.
  • Never echo a resolvable {{secret:<name>}} placeholder into logs or returned strings.
  • This package is not affiliated with or endorsed by Functional Software, Inc. (Sentry).

Branding

The community icon is Sentry's official glyph from the public Sentry branding page (glyph, light-on-dark). The path is unmodified. Sentry® and the Sentry glyph are trademarks of Functional Software, Inc.