MCPcopy
hub / github.com/continuedev/continue / DiffContextProvider

Class DiffContextProvider

core/context/providers/DiffContextProvider.ts:8–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import { BaseContextProvider } from "../index.js";
7
8class DiffContextProvider extends BaseContextProvider {
9 static description: ContextProviderDescription = {
10 title: "diff",
11 displayTitle: "Git Diff",
12 description: "Reference the current git diff",
13 type: "normal",
14 };
15
16 async getContextItems(
17 query: string,
18 extras: ContextProviderExtras,
19 ): Promise<ContextItem[]> {
20 const includeUnstaged = this.options?.includeUnstaged ?? true;
21 const diffs = await extras.ide.getDiff(includeUnstaged); // TODO use diff cache (currently cache always includes unstaged)
22 return [
23 {
24 description: "The current git diff",
25 content:
26 diffs.length === 0
27 ? "Git shows no current changes."
28 : `\`\`\`git diff\n${diffs.join("\n")}\n\`\`\``,
29 name: "Git Diff",
30 },
31 ];
32 }
33}
34
35export default DiffContextProvider;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected