-
Notifications
You must be signed in to change notification settings - Fork 7
feat(packaging): ship wrapper-first Next.js npm integration #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c0911d8
feat: Make junior deployable as an npm dependency
dcramer ecbc66c
ref: Move Sentry home content to jr-sentry/ and use home module
dcramer 8b2b969
chore(rebase): Align lockfile and thread normalization test
dcramer af5eea7
fix(packaging): Restore deployable runtime compatibility
dcramer 46d0e89
ref(packaging): Move to wrapper-first Next.js integration
dcramer b25a808
fix(next): Declare runtime directly in app routes
dcramer 27eb17c
feat(package): Switch to convention-based Next.js project layout
dcramer 8efbf08
docs(readme): Use JS wrapper files in Next.js setup
dcramer 22bc9c7
fix(packaging): preserve tracing includes and webhook route parity
dcramer 9ed60db
fix(packaging): restore slack file_share handling patch
dcramer 1af3c2d
fix(config): restore AI_MODEL fallback for fast model
dcramer c144c30
fix(config): dedupe server external package defaults
dcramer ff84291
fix(build): declare smol-toml as runtime dependency
dcramer 3838d32
fix(packaging): align handler exports and external deps
dcramer a264bd8
test(packaging): stop asserting handler runtime export
dcramer 4966798
build(workspace): add jr-sentry consumer app workspace
dcramer cac70e7
build(packaging): remove unused smol-toml dependency
dcramer 6b85ee8
ref(monorepo): relocate junior into packages workspace
dcramer cca0b01
fix(templates): remove unused sentry release env vars
dcramer 72582c6
fix(build): make junior build stable in workspace layout
dcramer d73baf3
fix(router): forward oauth callback requests in catch-all handler
dcramer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,15 @@ | ||
| # junior | ||
| # junior monorepo | ||
|
|
||
| Slack bot built with Next.js + Chat SDK. | ||
| This repository is organized as a workspace: | ||
|
|
||
| Junior responds when mentioned in Slack and can continue replying in subscribed threads. It also supports slash-invoked local skills (`/skill-name ...`) and built-in tools (web search/fetch, image generation, Slack canvases/lists). | ||
| - `packages/junior`: publishable `junior` package and source | ||
| - `packages/jr-sentry`: smoke-test consumer app that uses `junior` via `workspace:*` | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js 20+ | ||
| - pnpm | ||
| - Vercel CLI | ||
| - Slack app credentials already configured in Vercel | ||
| - Redis configured in Vercel (`REDIS_URL`) | ||
|
|
||
| ## Local setup | ||
|
|
||
| 1. Install dependencies. | ||
| Common commands from repo root: | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| pnpm build:pkg | ||
| pnpm test | ||
| pnpm --filter jr-sentry build | ||
| ``` | ||
|
|
||
| 2. Link this repo to the Sentry Vercel project and pull dev env. | ||
|
|
||
| ```bash | ||
| pnpm dlx vercel@latest login | ||
| pnpm dlx vercel@latest switch | ||
| pnpm dlx vercel@latest link --yes --scope sentry | ||
| pnpm dlx vercel@latest env pull .env --environment=development --scope sentry | ||
| ``` | ||
|
|
||
| 3. Start the app. | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| ## Slack tunnel (Cloudflare) | ||
|
|
||
| Install `cloudflared` if you don't have it (`brew install cloudflared` on macOS). | ||
|
|
||
| ### Quick (random hostname each time) | ||
|
|
||
| ```bash | ||
| cloudflared tunnel --url http://localhost:3000 | ||
| ``` | ||
|
|
||
| ### Stable hostname (one-time setup) | ||
|
|
||
| Requires a free Cloudflare account and a domain managed through Cloudflare DNS. | ||
|
|
||
| ```bash | ||
| cloudflared tunnel login | ||
| cloudflared tunnel create junior-dev | ||
| cloudflared tunnel route dns junior-dev junior-dev.yourdomain.com | ||
| ``` | ||
|
|
||
| Then each time you develop: | ||
|
|
||
| ```bash | ||
| cloudflared tunnel run --url http://localhost:3000 junior-dev | ||
| ``` | ||
|
|
||
| ### Configuring Slack | ||
|
|
||
| Set Slack Event Subscriptions and Interactivity request URL to: | ||
|
|
||
| ```text | ||
| https://<tunnel-host>/api/webhooks/slack | ||
| ``` | ||
|
|
||
| With a stable hostname you only need to do this once. Invite `@junior` to a channel and mention it. | ||
|
|
||
| ## Evals | ||
|
|
||
| Use evals for end-to-end behavior testing of Junior's reply pipeline (prompting, tools, and expected outputs) with LLM-judged numeric scoring. | ||
|
|
||
| Evals intentionally exclude live Slack integration concerns (Slack transport, app permissions, and webhook delivery). | ||
|
|
||
| Authoring guidance lives in `evals/README.md` and `specs/testing/evals-spec.md`. | ||
|
|
||
| ```bash | ||
| pnpm evals | ||
| ``` | ||
|
|
||
| ## Test env isolation | ||
|
|
||
| Vitest loads `.env`, `.env.local`, `.env.test`, then `.env.test.local` so test-specific values override development/prod values. | ||
|
|
||
| Slack credentials are intentionally replaced with test values for tests/evals to prevent accidental use of real Slack tokens. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| SLACK_BOT_TOKEN= | ||
| SLACK_SIGNING_SECRET= | ||
| JUNIOR_BOT_NAME= | ||
| AI_MODEL= | ||
| AI_FAST_MODEL= | ||
| REDIS_URL= | ||
| NEXT_PUBLIC_SENTRY_DSN= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules/ | ||
| .next/ | ||
| .env | ||
| .env.local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { GET, POST } from "junior/handler"; | ||
| export const runtime = "nodejs"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from "junior/app/layout"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # jr-sentry | ||
|
|
||
| You are jr-sentry, a helpful assistant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { register, onRequestError } from "junior/instrumentation"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { withJunior } from "junior/config"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| export default withJunior({ | ||
| turbopack: { | ||
| root: path.resolve(__dirname, "../..") | ||
| } | ||
|
dcramer marked this conversation as resolved.
|
||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "jr-sentry", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "build": "next build", | ||
| "start": "next start" | ||
| }, | ||
| "dependencies": { | ||
| "@sentry/nextjs": "^10.0.0", | ||
| "junior": "workspace:*", | ||
| "next": "^16.0.0", | ||
| "react": "^19.0.0", | ||
| "react-dom": "^19.0.0" | ||
| } | ||
| } |
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| SLACK_BOT_TOKEN= | ||
| SLACK_SIGNING_SECRET= | ||
| JUNIOR_BOT_NAME= # Defaults to "junior" | ||
| AI_MODEL= # Defaults to anthropic/claude-sonnet-4.6 | ||
| AI_FAST_MODEL= # Defaults to anthropic/claude-haiku-4-5 | ||
| REDIS_URL= | ||
| SKILL_DIRS= # Additional skill directories (colon-separated) | ||
| GITHUB_APP_ID= | ||
| GITHUB_APP_PRIVATE_KEY= | ||
| GITHUB_INSTALLATION_ID= | ||
| NEXT_PUBLIC_SENTRY_DSN= |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.