-
Notifications
You must be signed in to change notification settings - Fork 1
agent: @U0AJM7X8FBR read the mono repo, then ULTRATHINK about our non-technical #295
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
base: test
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,36 +3,14 @@ import { after } from "next/server"; | |
| import { codingAgentBot } from "@/lib/coding-agent/bot"; | ||
| import "@/lib/coding-agent/handlers/registerHandlers"; | ||
|
|
||
| /** | ||
| * GET /api/coding-agent/[platform] | ||
| * | ||
| * Handles webhook verification handshakes (e.g. WhatsApp hub.challenge). | ||
| * | ||
| * @param request - The incoming verification request | ||
| * @param params - Route params containing the platform name | ||
| */ | ||
| export async function GET( | ||
| request: NextRequest, | ||
| { params }: { params: Promise<{ platform: string }> }, | ||
| ) { | ||
| const { platform } = await params; | ||
|
|
||
| const handler = codingAgentBot.webhooks[platform as keyof typeof codingAgentBot.webhooks]; | ||
|
|
||
| if (!handler) { | ||
| return new Response("Unknown platform", { status: 404 }); | ||
| } | ||
|
|
||
| return handler(request, { waitUntil: p => after(() => p) }); | ||
| } | ||
|
|
||
| /** | ||
| * POST /api/coding-agent/[platform] | ||
| * | ||
| * Webhook endpoint for the coding agent bot. | ||
| * Handles Slack and WhatsApp webhooks via dynamic [platform] segment. | ||
| * Currently handles Slack webhooks via dynamic [platform] segment. | ||
| * | ||
| * @param request - The incoming webhook request | ||
| * @param params.params | ||
| * @param params - Route params containing the platform name | ||
|
Comment on lines
+13
to
14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the malformed JSDoc param reference.
✏️ Suggested doc fix- * `@param` params.params
- * `@param` params - Route params containing the platform name
+ * `@param` context - Route context
+ * `@param` context.params - Route params containing the platform name🤖 Prompt for AI Agents |
||
| */ | ||
| export async function POST( | ||
|
|
@@ -44,8 +22,11 @@ export async function POST( | |
| // Handle Slack url_verification challenge before loading the bot. | ||
| // This avoids blocking on Redis/adapter initialization during setup. | ||
| if (platform === "slack") { | ||
| const body = await request.clone().json().catch(() => null); | ||
| if (body?.type === "url_verification" && typeof body?.challenge === "string") { | ||
| const body = await request | ||
| .clone() | ||
| .json() | ||
| .catch(() => null); | ||
| if (body?.type === "url_verification" && body?.challenge) { | ||
| return Response.json({ challenge: body.challenge }); | ||
|
Comment on lines
+25
to
30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep URL verification strict on The current guard accepts any truthy 🛡️ Suggested fix- if (body?.type === "url_verification" && body?.challenge) {
+ if (body?.type === "url_verification" && typeof body?.challenge === "string") {
return Response.json({ challenge: body.challenge });
}🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate/confusing JSDoc
@paramtags.Line 26 adds
@param params.paramswhich is incorrectly formatted and redundant with line 27's@param params - Route params containing the account ID. Theparams.paramssyntax doesn't follow JSDoc conventions for nested properties (which would be@param {object} paramsfollowed by@param {string} params.id).📝 Suggested fix - remove the redundant tag
* `@param` request - The request object - * `@param` params.params * `@param` params - Route params containing the account ID * `@returns` A NextResponse with account data📝 Committable suggestion
🤖 Prompt for AI Agents