Skip to content

Commit 380c7b6

Browse files
committed
Rename the prune context feature to find relevant files throughout the codebase and implement a migration for existing settings and state keys
- rename 'prune context' to 'find relevant files' - Create an appropriate migration for the changes [Changes]
1 parent 897f272 commit 380c7b6

58 files changed

Lines changed: 693 additions & 507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const main = async () => {
196196
| 'ask-about-context'
197197
| 'edit-context'
198198
| 'code-at-cursor'
199-
| 'prune-context'
199+
| 'find-relevant-files'
200200
| 'no-context'
201201
}
202202

@@ -231,7 +231,7 @@ const main = async () => {
231231
chatbot?.inject_apply_response_button &&
232232
(stored_data.prompt_type == 'edit-context' ||
233233
stored_data.prompt_type == 'code-at-cursor' ||
234-
stored_data.prompt_type == 'prune-context')
234+
stored_data.prompt_type == 'find-relevant-files')
235235
) {
236236
sessionStorage.setItem(
237237
session_data_key,

‎apps/editor/package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@
868868
"type": "string",
869869
"scope": "resource"
870870
},
871-
"codeWebChat.pruneContextInstructionsPrefix": {
871+
"codeWebChat.findRelevantFilesInstructionsPrefix": {
872872
"type": "string",
873873
"scope": "resource"
874874
},
@@ -1356,7 +1356,7 @@
13561356
}
13571357
}
13581358
},
1359-
"codeWebChat.chatPresetsForPruneContext": {
1359+
"codeWebChat.chatPresetsForFindRelevantFiles": {
13601360
"type": "array",
13611361
"scope": "resource",
13621362
"default": [
@@ -1742,7 +1742,7 @@
17421742
]
17431743
}
17441744
},
1745-
"codeWebChat.promptTemplatesForPruneContext": {
1745+
"codeWebChat.promptTemplatesForFindRelevantFiles": {
17461746
"type": "array",
17471747
"scope": "resource",
17481748
"default": [],
@@ -1813,7 +1813,7 @@
18131813
]
18141814
}
18151815
},
1816-
"codeWebChat.configurationsForPruneContext": {
1816+
"codeWebChat.configurationsForFindRelevantFiles": {
18171817
"type": "array",
18181818
"scope": "resource",
18191819
"default": [],

‎apps/editor/src/constants/instructions.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export const intelligent_update_instructions =
2828
export const commit_message_instructions =
2929
"Write a brief and precise summary for the changes, limited to a single sentence. Because the summary will be used for a commit message, don't use any markdown formatting and don't include a trailing dot. Use an imperative tone to ensure clarity and focus on the primary change or purpose."
3030

31-
export const prune_context_instructions_prefix =
31+
export const find_relevant_files_instructions_prefix =
3232
"Find all files building modules of the task's scope."
3333

34-
export const prune_context_format = `<system>
34+
export const find_relevant_files_format = `<system>
3535
Your response must begin with "**Relevant files:**", then list paths one under another. Don't send anything else. Example:
3636
3737
**Relevant files:**

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,23 @@ export const INSTRUCTIONS_ASK_STATE_KEY = 'instructions-ask'
4040
export const INSTRUCTIONS_NO_CONTEXT_STATE_KEY = 'instructions-no-context'
4141
export const INSTRUCTIONS_CODE_AT_CURSOR_STATE_KEY =
4242
'instructions-code-at-cursor'
43-
export const INSTRUCTIONS_PRUNE_CONTEXT_STATE_KEY = 'instructions-prune-context'
43+
export const INSTRUCTIONS_FIND_RELEVANT_FILES_STATE_KEY =
44+
'instructions-find-relevant-files'
4445

4546
export const ARE_TASKS_COLLAPSED_STATE_KEY = 'are-tasks-collapsed'
4647
export const IS_TIMELINE_COLLAPSED_STATE_KEY = 'is-timeline-collapsed'
4748

4849
export const HISTORY_ASK_STATE_KEY = 'history-ask'
4950
export const HISTORY_EDIT_STATE_KEY = 'history-edit'
5051
export const HISTORY_CODE_AT_CURSOR_STATE_KEY = 'history-code-at-cursor'
51-
export const HISTORY_PRUNE_CONTEXT_STATE_KEY = 'history-prune-context'
52+
export const HISTORY_FIND_RELEVANT_FILES_STATE_KEY =
53+
'history-find-relevant-files'
5254
export const HISTORY_NO_CONTEXT_STATE_KEY = 'history-no-context'
5355

5456
export const RECENTLY_USED_CODE_AT_CURSOR_CONFIG_IDS_STATE_KEY =
5557
'recently-used-code-at-cursor-config-ids'
56-
export const RECENTLY_USED_PRUNE_CONTEXT_CONFIG_IDS_STATE_KEY =
57-
'recently-used-prune-context-config-ids'
58+
export const RECENTLY_USED_FIND_RELEVANT_FILES_CONFIG_IDS_STATE_KEY =
59+
'recently-used-find-relevant-files-config-ids'
5860
export const RECENTLY_USED_EDIT_CONTEXT_CONFIG_IDS_STATE_KEY =
5961
'recently-used-edit-context-config-ids'
6062
export const RECENTLY_USED_COMMIT_MESSAGES_CONFIG_IDS_STATE_KEY =

‎apps/editor/src/extension.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
migrate_configurations_code_completions_to_code_at_cursor,
99
migrate_instructions_state_cleanup,
1010
migrate_checkpoints_title_to_trigger,
11-
migrate_model_providers_type
11+
migrate_model_providers_type,
12+
migrate_prune_context_to_find_relevant_files
1213
} from './migrations'
1314
import { SharedFileState } from './context/shared-file-state'
1415
import {
@@ -62,6 +63,8 @@ export async function activate(context: vscode.ExtensionContext) {
6263
await migrate_checkpoints_title_to_trigger(context)
6364
// 5 March 2026
6465
await migrate_model_providers_type(context)
66+
// 10 March 2026
67+
await migrate_prune_context_to_find_relevant_files(context)
6568
}
6669

6770
await migrations()

‎apps/editor/src/i18n/translations/commands/apply-chat-response.ts‎

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,57 +54,57 @@ export const apply_chat_response = {
5454
bg: 'Прилагане с Интелигентно актуализиране'
5555
},
5656
'command.apply-chat-response.context-pruning.title': {
57-
en: 'Context Pruning',
58-
pl: 'Przycinanie kontekstu',
59-
'zh-cn': '上下文修剪',
60-
ja: 'コンテキストのプルーニング',
61-
'zh-tw': '上下文修剪',
62-
de: 'Kontext-Pruning',
63-
es: 'Poda de contexto',
64-
fr: 'Élagage du contexte',
65-
'pt-br': 'Poda de contexto',
66-
ru: 'Очистка контекста',
67-
ko: '컨텍스트 가지치기',
68-
it: 'Potatura del contesto',
69-
tr: 'Bağlam Budama',
70-
cs: 'Oříznutí kontextu',
71-
hu: 'Kontextus ritkítása',
72-
bg: 'Подрязване на контекста'
57+
en: 'Find Relevant Files',
58+
pl: 'Znajdowanie odpowiednich plików',
59+
'zh-cn': '查找相关文件',
60+
ja: '関連ファイルの検索',
61+
'zh-tw': '尋找相關檔案',
62+
de: 'Relevante Dateien finden',
63+
es: 'Buscar archivos relevantes',
64+
fr: 'Trouver les fichiers pertinents',
65+
'pt-br': 'Encontrar arquivos relevantes',
66+
ru: 'Поиск соответствующих файлов',
67+
ko: '관련 파일 찾기',
68+
it: 'Trova file rilevanti',
69+
tr: 'İlgili Dosyaları Bul',
70+
cs: 'Najít relevantní soubory',
71+
hu: 'Releváns fájlok keresése',
72+
bg: 'Намиране на съответните файлове'
7373
},
7474
'command.apply-chat-response.context-pruning.placeholder': {
75-
en: 'Confirm new context',
76-
pl: 'Potwierdź nowy kontekst',
77-
'zh-cn': '确认新上下文',
78-
ja: '新しいコンテキストを確定',
79-
'zh-tw': '確認新上下文',
80-
de: 'Neuen Kontext bestätigen',
81-
es: 'Confirmar nuevo contexto',
82-
fr: 'Confirmer le nouveau contexte',
83-
'pt-br': 'Confirmar novo contexto',
84-
ru: 'Подтвердите новый контекст',
85-
ko: '새 컨텍스트 확인',
86-
it: 'Conferma nuovo contesto',
87-
tr: 'Yeni bağlamı onayla',
88-
cs: 'Potvrdit nový kontext',
89-
hu: 'Új kontextus megerősítése',
90-
bg: 'Потвърдете новия контекст'
75+
en: 'Confirm relevant files',
76+
pl: 'Potwierdź odpowiednie pliki',
77+
'zh-cn': '确认相关文件',
78+
ja: '関連ファイルを確認',
79+
'zh-tw': '確認相關檔案',
80+
de: 'Relevante Dateien bestätigen',
81+
es: 'Confirmar archivos relevantes',
82+
fr: 'Confirmer les fichiers pertinents',
83+
'pt-br': 'Confirmar arquivos relevantes',
84+
ru: 'Подтвердить соответствующие файлы',
85+
ko: '관련 파일 확인',
86+
it: 'Conferma file rilevanti',
87+
tr: 'İlgili dosyaları onayla',
88+
cs: 'Potvrdit relevantní soubory',
89+
hu: 'Releváns fájlok megerősítése',
90+
bg: 'Потвърдете съответните файлове'
9191
},
9292
'command.apply-chat-response.context-pruning.success': {
93-
en: 'Context pruned successfully.',
94-
pl: 'Kontekst został pomyślnie przycięty.',
95-
'zh-cn': '上下文修剪成功。',
96-
ja: 'コンテキストのプルーニングが完了しました。',
97-
'zh-tw': '上下文修剪成功。',
98-
de: 'Kontext erfolgreich bereinigt.',
99-
es: 'Contexto podado con éxito.',
100-
fr: 'Contexte élagué avec succès.',
101-
'pt-br': 'Contexto podado com sucesso.',
102-
ru: 'Контекст успешно очищен.',
103-
ko: '컨텍스트가 성공적으로 가지치기되었습니다.',
104-
it: 'Contesto potato con successo.',
105-
tr: 'Bağlam başarıyla budandı.',
106-
cs: 'Kontext úspěšně oříznut.',
107-
hu: 'A kontextus ritkítása sikeresen befejeződött.',
108-
bg: 'Контекстът е успешно подрязан.'
93+
en: 'Relevant files found successfully.',
94+
pl: 'Pomyślnie znaleziono odpowiednie pliki.',
95+
'zh-cn': '成功找到相关文件。',
96+
ja: '関連ファイルが正常に見つかりました。',
97+
'zh-tw': '成功找到相關檔案。',
98+
de: 'Relevante Dateien erfolgreich gefunden.',
99+
es: 'Archivos relevantes encontrados exitosamente.',
100+
fr: 'Fichiers pertinents trouvés avec succès.',
101+
'pt-br': 'Arquivos relevantes encontrados com sucesso.',
102+
ru: 'Соответствующие файлы успешно найдены.',
103+
ko: '관련 파일을 성공적으로 찾았습니다.',
104+
it: 'File rilevanti trovati con successo.',
105+
tr: 'İlgili dosyalar başarıyla bulundu.',
106+
cs: 'Relevantní soubory úspěšně nalezeny.',
107+
hu: 'A releváns fájlok sikeresen megtalálva.',
108+
bg: 'Съответните файлове са намерени успешно.'
109109
}
110110
} as const

‎apps/editor/src/migrations/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './migrate-configurations-code-completions-to-code-at-cursor'
33
export * from './migrate-instructions-state-cleanup'
44
export * from './migrate-checkpoints-title-to-trigger'
55
export * from './migrate-model-providers-type'
6+
export * from './migrate-prune-context-to-find-relevant-files'

‎apps/editor/src/migrations/migrate-instructions-state-cleanup.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const KEYS_TO_CLEAR = [
88
'instructions-ask',
99
'instructions-no-context',
1010
'instructions-code-at-cursor',
11-
'instructions-prune-context'
11+
'instructions-find-relevant-files'
1212
]
1313

1414
/**
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import * as vscode from 'vscode'
2+
import { Logger } from '@shared/utils/logger'
3+
4+
const MIGRATION_ID = 'prune-context-to-find-relevant-files-migration-20260310'
5+
6+
export async function migrate_prune_context_to_find_relevant_files(
7+
context: vscode.ExtensionContext
8+
): Promise<void> {
9+
try {
10+
if (context.globalState.get(MIGRATION_ID)) {
11+
return
12+
}
13+
14+
const config = vscode.workspace.getConfiguration('codeWebChat')
15+
const CONFIG_KEYS = [
16+
{
17+
old: 'pruneContextInstructionsPrefix',
18+
new: 'findRelevantFilesInstructionsPrefix'
19+
},
20+
{
21+
old: 'chatPresetsForPruneContext',
22+
new: 'chatPresetsForFindRelevantFiles'
23+
},
24+
{
25+
old: 'promptTemplatesForPruneContext',
26+
new: 'promptTemplatesForFindRelevantFiles'
27+
},
28+
{
29+
old: 'configurationsForPruneContext',
30+
new: 'configurationsForFindRelevantFiles'
31+
}
32+
]
33+
34+
for (const { old: old_key, new: new_key } of CONFIG_KEYS) {
35+
const inspect = config.inspect<any>(old_key)
36+
if (inspect?.globalValue !== undefined) {
37+
await config.update(
38+
new_key,
39+
inspect.globalValue,
40+
vscode.ConfigurationTarget.Global
41+
)
42+
await config.update(
43+
old_key,
44+
undefined,
45+
vscode.ConfigurationTarget.Global
46+
)
47+
}
48+
}
49+
50+
const STATE_KEYS = [
51+
{ old: 'history-prune-context', new: 'history-find-relevant-files' },
52+
{
53+
old: 'instructions-prune-context',
54+
new: 'instructions-find-relevant-files'
55+
},
56+
{
57+
old: 'recently-used-prune-context-config-ids',
58+
new: 'recently-used-find-relevant-files-config-ids'
59+
},
60+
{
61+
old: 'presets-collapsed-prune-context',
62+
new: 'presets-collapsed-find-relevant-files'
63+
},
64+
{
65+
old: 'configurations-collapsed-prune-context',
66+
new: 'configurations-collapsed-find-relevant-files'
67+
},
68+
{
69+
old: 'recently-used-presets-or-groups-prune-context',
70+
new: 'recently-used-presets-or-groups-find-relevant-files'
71+
}
72+
]
73+
74+
for (const { old: old_key, new: new_key } of STATE_KEYS) {
75+
const global_val = context.globalState.get(old_key)
76+
if (global_val !== undefined) {
77+
await context.globalState.update(new_key, global_val)
78+
await context.globalState.update(old_key, undefined)
79+
}
80+
81+
const workspace_val = context.workspaceState.get(old_key)
82+
if (workspace_val !== undefined) {
83+
await context.workspaceState.update(new_key, workspace_val)
84+
await context.workspaceState.update(old_key, undefined)
85+
}
86+
}
87+
88+
const modes = ['web-mode', 'api-mode']
89+
for (const mode_key of modes) {
90+
const global_val = context.globalState.get(mode_key)
91+
if (global_val === 'prune-context') {
92+
await context.globalState.update(mode_key, 'find-relevant-files')
93+
}
94+
95+
const workspace_val = context.workspaceState.get(mode_key)
96+
if (workspace_val === 'prune-context') {
97+
await context.workspaceState.update(mode_key, 'find-relevant-files')
98+
}
99+
}
100+
101+
await context.globalState.update(MIGRATION_ID, true)
102+
Logger.info({
103+
function_name: 'migrate_prune_context_to_find_relevant_files',
104+
message: 'Successfully migrated prune-context to find-relevant-files'
105+
})
106+
} catch (error) {
107+
Logger.error({
108+
function_name: 'migrate_prune_context_to_find_relevant_files',
109+
message: 'Error migrating prune-context to find-relevant-files',
110+
data: error instanceof Error ? error.message : String(error)
111+
})
112+
}
113+
}

0 commit comments

Comments
 (0)