@@ -1265,47 +1265,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
12651265 break
12661266 case "getSystemPrompt" :
12671267 try {
1268- const {
1269- apiConfiguration,
1270- customModePrompts,
1271- customInstructions,
1272- preferredLanguage,
1273- browserViewportSize,
1274- diffEnabled,
1275- mcpEnabled,
1276- fuzzyMatchThreshold,
1277- experiments,
1278- enableMcpServerCreation,
1279- } = await this . getState ( )
1280-
1281- // Create diffStrategy based on current model and settings
1282- const diffStrategy = getDiffStrategy (
1283- apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
1284- fuzzyMatchThreshold ,
1285- Experiments . isEnabled ( experiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
1286- )
1287- const cwd =
1288- vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 ) || ""
1289-
1290- const mode = message . mode ?? defaultModeSlug
1291- const customModes = await this . customModesManager . getCustomModes ( )
1292-
1293- const systemPrompt = await SYSTEM_PROMPT (
1294- this . context ,
1295- cwd ,
1296- apiConfiguration . openRouterModelInfo ?. supportsComputerUse ?? false ,
1297- mcpEnabled ? this . mcpHub : undefined ,
1298- diffStrategy ,
1299- browserViewportSize ?? "900x600" ,
1300- mode ,
1301- customModePrompts ,
1302- customModes ,
1303- customInstructions ,
1304- preferredLanguage ,
1305- diffEnabled ,
1306- experiments ,
1307- enableMcpServerCreation ,
1308- )
1268+ const systemPrompt = await generateSystemPrompt ( message )
13091269
13101270 await this . postMessageToWebview ( {
13111271 type : "systemPrompt" ,
@@ -1319,6 +1279,19 @@ export class ClineProvider implements vscode.WebviewViewProvider {
13191279 vscode . window . showErrorMessage ( "Failed to get system prompt" )
13201280 }
13211281 break
1282+ case "copySystemPrompt" :
1283+ try {
1284+ const systemPrompt = await generateSystemPrompt ( message )
1285+
1286+ await vscode . env . clipboard . writeText ( systemPrompt )
1287+ await vscode . window . showInformationMessage ( "System prompt successfully copied to clipboard" )
1288+ } catch ( error ) {
1289+ this . outputChannel . appendLine (
1290+ `Error getting system prompt: ${ JSON . stringify ( error , Object . getOwnPropertyNames ( error ) , 2 ) } ` ,
1291+ )
1292+ vscode . window . showErrorMessage ( "Failed to get system prompt" )
1293+ }
1294+ break
13221295 case "searchCommits" : {
13231296 const cwd = vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 )
13241297 if ( cwd ) {
@@ -1524,6 +1497,50 @@ export class ClineProvider implements vscode.WebviewViewProvider {
15241497 null ,
15251498 this . disposables ,
15261499 )
1500+
1501+ const generateSystemPrompt = async ( message : WebviewMessage ) => {
1502+ const {
1503+ apiConfiguration,
1504+ customModePrompts,
1505+ customInstructions,
1506+ preferredLanguage,
1507+ browserViewportSize,
1508+ diffEnabled,
1509+ mcpEnabled,
1510+ fuzzyMatchThreshold,
1511+ experiments,
1512+ enableMcpServerCreation,
1513+ } = await this . getState ( )
1514+
1515+ // Create diffStrategy based on current model and settings
1516+ const diffStrategy = getDiffStrategy (
1517+ apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
1518+ fuzzyMatchThreshold ,
1519+ Experiments . isEnabled ( experiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
1520+ )
1521+ const cwd = vscode . workspace . workspaceFolders ?. map ( ( folder ) => folder . uri . fsPath ) . at ( 0 ) || ""
1522+
1523+ const mode = message . mode ?? defaultModeSlug
1524+ const customModes = await this . customModesManager . getCustomModes ( )
1525+
1526+ const systemPrompt = await SYSTEM_PROMPT (
1527+ this . context ,
1528+ cwd ,
1529+ apiConfiguration . openRouterModelInfo ?. supportsComputerUse ?? false ,
1530+ mcpEnabled ? this . mcpHub : undefined ,
1531+ diffStrategy ,
1532+ browserViewportSize ?? "900x600" ,
1533+ mode ,
1534+ customModePrompts ,
1535+ customModes ,
1536+ customInstructions ,
1537+ preferredLanguage ,
1538+ diffEnabled ,
1539+ experiments ,
1540+ enableMcpServerCreation ,
1541+ )
1542+ return systemPrompt
1543+ }
15271544 }
15281545
15291546 /**
0 commit comments