Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/issue-triage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
// Needs: ANTHROPIC_API_KEY (repo secret) and GH_TOKEN (the workflow's GITHUB_TOKEN).
import fs from "node:fs";
import { execFileSync } from "node:child_process";
import Anthropic from "@anthropic-ai/sdk";
// NB: @anthropic-ai/sdk is imported lazily inside classifyViaSdk() — the OAuth
// transport installs only the Claude Code CLI, not the SDK, so a static
// top-level import would ERR_MODULE_NOT_FOUND before any code runs.

// Haiku 4.5 — fast and cheap, ideal for a high-volume issue classifier.
// Switch to "claude-opus-4-8" for maximum classification accuracy.
Expand Down Expand Up @@ -75,7 +77,8 @@ function classifyViaClaudeCli(userContent) {
}

async function classifyViaSdk(userContent) {
const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env
const { default: Anthropic } = await import("@anthropic-ai/sdk"); // reads ANTHROPIC_API_KEY from env
const client = new Anthropic();
const resp = await client.messages.create({
model: MODEL,
max_tokens: 1024,
Expand Down
5 changes: 4 additions & 1 deletion scripts/pr-review.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// logs and exits 0 — a broken bot must never block a PR.
import fs from "node:fs";
import { execFileSync } from "node:child_process";
import Anthropic from "@anthropic-ai/sdk";
// NB: @anthropic-ai/sdk is imported lazily inside reviewViaSdk() — the OAuth
// transport installs only the Claude Code CLI, not the SDK, so a static
// top-level import would ERR_MODULE_NOT_FOUND before any code runs.

// Sonnet: PR review needs real reasoning; still cents per run at PR-diff sizes.
const MODEL = "claude-sonnet-4-6";
Expand Down Expand Up @@ -243,6 +245,7 @@ function reviewViaClaudeCli(userPrompt) {
}

async function reviewViaSdk(userPrompt) {
const { default: Anthropic } = await import("@anthropic-ai/sdk");
const client = new Anthropic();
const resp = await client.messages.create({
model: MODEL,
Expand Down
Loading