@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 todryRun)
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.
- Create a token in Sentry: User settings → Personal Tokens or an internal integration.
- Grant at least
org:read,project:read, andevent:read. Addevent:writeonly if you will call mutatingrequestpaths. - Save it as
sentryAuthToken:
- Approve hosts
sentry.io,us.sentry.io, andde.sentry.ioon 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.
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(defaultsentryAuthToken). Save a second token assentryAuthTokenWorkand passsecretName: 'sentryAuthTokenWork'. - OAuth lane: pass
integration(for example'sentry'or'sentry-work').
Scopes and 403s
| Scope | Used for |
|---|---|
org:read | list-organizations and org-scoped reads |
project:read | list-projects, resolve-project |
event:read | issues and events |
event:write | mutating 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:
| Host | When to approve |
|---|---|
sentry.io | Default SaaS API host (start here) |
us.sentry.io | US data-storage region |
de.sentry.io | EU 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
| Export | Description |
|---|---|
. | Package overview and import pattern |
./list-organizations | Organizations accessible to the token |
./list-projects | Projects for an organization |
./resolve-project | Resolve a project by slug or numeric id |
./search-issues | Search issues (paginated, includeLatestSummaries) |
./get-issue | Fetch one issue by id |
./get-latest-issue-event | Latest event for an issue |
./get-issue-events | Recent events for an issue |
./summarize-issue-event | Summarize an event, or the latest event by issueId |
./triage-issue | Agent-ready triage bundle |
./request | Generic Sentry REST call; writes default to dry-run |
./smoke-test | Local host checks plus optional live org list |
Default exports match the file name (./list-organizations →
listOrganizations, ./request → sentryRequest, ./smoke-test →
smokeTest).
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
./requestwhen you need an unwrapped REST path. GET/HEAD/OPTIONSalways execute. Other methods on./requestdefault to{ dryRun: true, wouldCall }until you passdryRun: 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.