@sentry/junior-sentry 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +5 -90
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,96 +1,11 @@
1
- # sentry setup
1
+ # @sentry/junior-sentry
2
2
 
3
- This skill uses per-user OAuth tokens issued via the Authorization Code Grant flow.
3
+ `@sentry/junior-sentry` adds Sentry issue workflows to Junior via per-user OAuth.
4
4
 
5
- ## 1) Create Sentry OAuth application
6
-
7
- In your personal Sentry account:
8
- 1. Go to `User Settings -> Applications -> New Application` at `https://sentry.io/settings/account/api/applications/`.
9
- 2. Set the **Redirect URL** to `<base-url>/api/oauth/callback/sentry` (e.g. `https://your-app.vercel.app/api/oauth/callback/sentry`).
10
- 3. Save and collect:
11
- - `SENTRY_CLIENT_ID` (Client ID)
12
- - `SENTRY_CLIENT_SECRET` (Client Secret)
13
-
14
- Scopes are requested at authorization time (not configured in the app). The app requests `event:read org:read project:read`.
15
-
16
- ## 2) Configure host runtime
17
-
18
- Set on the harness host (never in skill files):
19
- - `SENTRY_CLIENT_ID`
20
- - `SENTRY_CLIENT_SECRET`
21
-
22
- ### Vercel env setup
5
+ Install it alongside `@sentry/junior`:
23
6
 
24
7
  ```bash
25
- vercel env add SENTRY_CLIENT_ID production
26
- vercel env add SENTRY_CLIENT_SECRET production --sensitive
8
+ pnpm add @sentry/junior @sentry/junior-sentry
27
9
  ```
28
10
 
29
- If variables already exist, use `vercel env update` instead of `vercel env add`. Repeat for `preview` and `development` as needed. After env changes, redeploy so the new deployment picks up updated values.
30
-
31
- ### Base URL
32
-
33
- The OAuth redirect URI is built from the application's base URL. Resolved in order:
34
- 1. `JUNIOR_BASE_URL` env var (explicit override)
35
- 2. `VERCEL_PROJECT_PRODUCTION_URL` (auto-set by Vercel)
36
- 3. `VERCEL_URL` (deployment-specific fallback)
37
-
38
- The base URL must match the redirect URL registered in the Sentry integration above.
39
-
40
- ### Local development (without OAuth)
41
-
42
- Set `SENTRY_AUTH_TOKEN` to a static auth token. The broker falls back to this when no per-user OAuth token exists. Generate one at `https://<org>.sentry.io/settings/auth-tokens/`.
43
-
44
- ## 3) Runtime behavior
45
-
46
- - Each Slack user connects their own Sentry account via `/sentry auth`.
47
- - Tokens are stored per user in Redis (`oauth-token:<userId>:sentry`).
48
- - Credentials are issued lazily when `jr-rpc issue-credential sentry.api` is run.
49
- - If no token exists, the harness auto-starts the OAuth flow, sends an ephemeral authorization link, and auto-resumes the original request after the user authorizes.
50
- - The broker refreshes tokens within 5 minutes of expiry via `grant_type=refresh_token`.
51
- - Sandbox does not receive raw tokens via env; host applies scoped Authorization header transforms for Sentry API calls.
52
- - `SENTRY_AUTH_TOKEN` is injected in the lease env for CLI consumption (`sentry`).
53
-
54
- ## 4) CLI usage
55
-
56
- Run as a regular sandbox `bash` command while this skill is active:
57
-
58
- ```bash
59
- jr-rpc issue-credential sentry.api
60
- sentry issues list --org ORG --json
61
- ```
62
-
63
- Optional: set org/project once per channel so they don't need to be repeated:
64
-
65
- ```bash
66
- jr-rpc config set sentry.org getsentry
67
- jr-rpc config set sentry.project my-project
68
- ```
69
-
70
- ## 5) Quick verification
71
-
72
- - `pnpm skills:check`
73
- - `pnpm typecheck`
74
- - Run `/sentry auth` in a Slack thread and complete the OAuth flow.
75
- - Run `/sentry issue list` and confirm issues are returned.
76
-
77
- ## 6) Production verification (step-by-step)
78
-
79
- 1. Confirm host env vars are present in prod:
80
- - `SENTRY_CLIENT_ID`
81
- - `SENTRY_CLIENT_SECRET`
82
- 2. Confirm the redirect URL in the Sentry integration matches `<base-url>/api/oauth/callback/sentry`.
83
- 3. Deploy `main` to prod.
84
- 4. Run `/sentry auth` — verify ephemeral link appears and OAuth flow completes.
85
- 5. Verify callback posts "Your Sentry account is now connected" to the thread.
86
- 6. Run `/sentry issue list` — verify issues are returned without re-prompting for auth.
87
- 7. Run `/sentry disconnect` — verify tokens are cleared.
88
- 8. Run `/sentry issue list` again — verify auto-OAuth kicks in (ephemeral link + auto-resume after auth).
89
- 9. Verify raw token values are never printed in output or logs.
90
- 10. Check logs for:
91
- - `jr_rpc_oauth_start`
92
- - `credential_issue_request`
93
- - `credential_issue_success`
94
- - `credential_inject_start`
95
- - `credential_inject_cleanup`
96
- 11. Verify logs contain no token values.
11
+ Full setup guide: https://junior.sentry.dev/extend/sentry-plugin/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-sentry",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"