Skip to content

Commit 8111071

Browse files
committed
Filter out response items targeting excluded folders
- In apply-response-command.ts, filter response_items immediately after parse_response is called to completely exclude any items where file_path or new_file_path starts with .git/, .vscode/, .devcontainer/, vendor/, or node_modules/. - Refactor the file exclusion filter to check if any segment of the split `file_path` or `new_file_path` matches a Set of common dependency and build folders (like `.git`, `node_modules`, `vendor`, `.venv`, `dist`, `build`, `target`, `bin`, `obj`), replacing the current `startsWith` logic to support nested directories. └── apps └── editor └── src └── commands └── apply-response-command ├── apply-response-command.ts ├── response-processor │ ├── handlers │ │ ├── diff-handler.ts │ │ ├── fast-replace-handler.ts │ │ ├── patch-repair-handler.ts │ │ ├── restore-preview-handler.ts │ │ └── truncated-handler.ts │ └── response-processor.ts ├── types │ └── original-file-state.ts └── utils ├── file-operations │ └── index.ts ├── preview │ ├── file-preparer.ts │ ├── preview.ts │ ├── temp-file-manager.ts │ └── workspace-listener.ts ├── preview-handler.ts └── response-parser ├── index.ts └── response-parser.ts
1 parent 382c7b5 commit 8111071

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎apps/editor/src/commands/apply-response-command/apply-response-command.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,38 @@ export const apply_response_command = (params: {
112112
workspace_files
113113
})
114114

115+
const excluded_folders = new Set([
116+
'.git',
117+
'node_modules',
118+
'vendor',
119+
'.venv',
120+
'dist',
121+
'build',
122+
'target',
123+
'bin',
124+
'obj'
125+
])
126+
127+
response_items = response_items.filter((item: any) => {
128+
if (
129+
item.file_path &&
130+
item.file_path
131+
.split(/[/\\]/)
132+
.some((segment: string) => excluded_folders.has(segment))
133+
) {
134+
return false
135+
}
136+
if (
137+
item.new_file_path &&
138+
item.new_file_path
139+
.split(/[/\\]/)
140+
.some((segment: string) => excluded_folders.has(segment))
141+
) {
142+
return false
143+
}
144+
return true
145+
})
146+
115147
const commit_message_item = response_items.find(
116148
(i) => i.type == 'commit-message'
117149
) as any

0 commit comments

Comments
 (0)