diff --git a/.claude/commands/ask-codebase.md b/.claude/commands/ask-codebase.md new file mode 100644 index 00000000000..ae591cca8ba --- /dev/null +++ b/.claude/commands/ask-codebase.md @@ -0,0 +1,111 @@ +You are a codebase intelligence agent for the BerriAI/litellm repository. + +The user's question is: + +$ARGUMENTS + +--- + +## Your job + +Answer the question by gathering evidence from GitHub and the local codebase. Follow the steps below, skipping any that are not relevant to the question. + +--- + +## Step 1 — Classify the question + +Determine what kind of question this is. Multiple types can apply. + +- **Issue status**: mentions "issue #N" or asks if a bug/request has been fixed or addressed +- **PR status**: mentions "PR #N" or asks if a change has landed / been merged +- **PR coverage**: asks whether a PR covers a specific scenario, edge case, or related bug +- **Code location**: asks where something lives in the codebase, how it is implemented, or what file handles X +- **General**: any other question about the codebase, architecture, or behaviour + +--- + +## Step 2 — Gather evidence + +Run only the lookups that are relevant to the question type. + +### For issue status questions + +``` +gh issue view --repo BerriAI/litellm --json number,title,state,body,closedAt,stateReason,comments,timelineItems +``` + +Then check for a closing PR: +- Look in `timelineItems` for `CrossReferencedEvent` or `ClosedEvent` entries that reference a PR +- Also run: `gh pr list --repo BerriAI/litellm --search "closes # OR fixes # OR fix #" --state all --json number,title,state,mergedAt,mergeCommit` +- If a linked PR is found, retrieve it: `gh pr view --repo BerriAI/litellm --json number,title,state,mergedAt,mergeCommit,baseRefName,files` + +Determine fixedness using this priority: +1. Issue closed + linked PR merged into main → **Fixed** (high confidence) +2. Issue closed + no linked PR → **Possibly fixed or stale-closed** (medium confidence) +3. Issue open + linked merged PR → **Likely fixed, issue not closed yet** (medium confidence) +4. Issue open + no merged PR → **Not fixed** (high confidence) + +### For PR status questions + +``` +gh pr view --repo BerriAI/litellm --json number,title,state,mergedAt,mergeCommit,baseRefName,headRefName,files,additions,deletions +``` + +Check whether it landed in main: +- `state: "MERGED"` and `baseRefName: "main"` → merged to main +- `state: "MERGED"` and `baseRefName != "main"` → merged to a feature/staging branch +- `state: "OPEN"` → still in review +- `state: "CLOSED"` (not merged) → abandoned + +Also run: +``` +git log --oneline --all | grep -i "" +git log --oneline main | head -30 +``` + +### For PR coverage questions + +Fetch the PR diff to understand what was actually changed: +``` +gh pr view --repo BerriAI/litellm --json files,body,comments +gh pr diff --repo BerriAI/litellm 2>/dev/null | head -200 +``` + +Then search the codebase for the scenario the user is asking about: +- Use Grep to find relevant code paths, error messages, or identifiers the question mentions +- Determine whether the diff touches those paths + +### For code location / general questions + +Extract the key concept, feature name, class name, or error string from the question, then: + +1. Grep for the most specific identifier first (function name, error text, class name) +2. Broaden to module-level search if needed (Glob for file patterns) +3. Read the 20–40 lines around the most relevant match +4. If the question is about behaviour or architecture, also search for tests: + `grep -r "" tests/ --include="*.py" -l` + +--- + +## Step 3 — Synthesize the answer + +Write a concise, direct answer. Structure it as follows: + +**Answer**: one sentence stating the conclusion clearly. + +**Evidence**: +- bullet list of the key facts gathered (PR number + merge date, commit SHA, file + line, etc.) +- include links where applicable + +**Confidence**: High / Medium / Low — and briefly why if not High. + +**Caveats** (only if relevant): e.g., "the fix landed in main but may not be in the latest PyPI release", or "the PR closed the reported case but the related edge case in file X is not covered". + +--- + +## Formatting rules + +- Be concise. Lead with the answer, not the reasoning. +- If you could not find enough evidence to answer confidently, say so explicitly rather than guessing. +- Do not list every file you searched — only include sources that directly support the answer. +- If the question contains a typo or ambiguity (e.g., wrong issue number, vague feature name), state the assumption you made and proceed. diff --git a/.claude/commands/deletable_PR_argument.md b/.claude/commands/deletable_PR_argument.md new file mode 100644 index 00000000000..3720d966630 --- /dev/null +++ b/.claude/commands/deletable_PR_argument.md @@ -0,0 +1,11 @@ +This is a table of PRs + +$ARGUMENT[0] + +from the above table, +for each row, + retrieve the PR number and PR age (in days) + checkout to the PR + analyze the PR and check if still is valid, specially considering its age: this is the verdict for knowing whether to close the PR, or seeing how to reactivate it (if it is worth it) + +Output in TSV format, containing PR number, link, author, PR age, verdict, and REASONING for your verdict diff --git a/.claude/commands/error_related_to_PR.md b/.claude/commands/error_related_to_PR.md new file mode 100644 index 00000000000..b34c5d1fcb5 --- /dev/null +++ b/.claude/commands/error_related_to_PR.md @@ -0,0 +1,7 @@ +Let the value for PR Number equals to $ARGUMENTS[0] + +Is this related to my PR [PR_NUMBER]? if yes, fix it; else, create a new PR fixing the issue. Is very IMPORTANT that the PR be as scoped as possible, just touching relevant files that fix the issue, and if required create the fix from the main branch, not just from the PR branch contents: this will guarantee consistency and fixing the error in general. + +The error found is: + +$ARGUMENTS[1] diff --git a/.gitignore b/.gitignore index 76cf6fdba2a..80e3a3c1974 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .venv_policy_test .env .claude +!.claude/commands .newenv newenv/* litellm/proxy/myenv/*