feat: add other useful variables to the custom system prompt (#2879)

This commit is contained in:
Daniel 2025-04-23 12:21:32 -05:00 committed by GitHub
parent 4606e9a6cc
commit 970ccd7879
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -5,6 +5,10 @@ import { fileExistsAtPath } from "../../../utils/fs"
export type PromptVariables = {
workspace?: string
mode?: string
language?: string
shell?: string
operatingSystem?: string
}
function interpolatePromptContent(content: string, variables: PromptVariables): string {

View file

@ -14,6 +14,7 @@ import { DiffStrategy } from "../../shared/tools"
import { McpHub } from "../../services/mcp/McpHub"
import { getToolDescriptionsForMode } from "./tools"
import * as vscode from "vscode"
import * as os from "os"
import {
getRulesSection,
getSystemInfoSection,
@ -128,6 +129,10 @@ export const SYSTEM_PROMPT = async (
// Try to load custom system prompt from file
const variablesForPrompt: PromptVariables = {
workspace: cwd,
mode: mode,
language: language ?? formatLanguage(vscode.env.language),
shell: vscode.env.shell,
operatingSystem: os.type(),
}
const fileCustomSystemPrompt = await loadSystemPromptFile(cwd, mode, variablesForPrompt)