Skip to content

Commit 985fbad

Browse files
committed
Refactor apply-from-clipboard and apply-from-terminal commands into flat modules, dispose terminal after accepted edits, and show informational notice for non-CLI terminals
- when applying from terminal, once response from Response Preview is accepted, we should close the flow initializing terminal ├── apps │ └── editor │ ├── package.json │ └── src │ ├── commands │ │ ├── apply-from-terminal-command.ts │ │ └── index.ts │ ├── extension.ts │ ├── features │ │ └── apply-response │ │ ├── apply-response.ts │ │ └── utils │ │ ├── preview │ │ │ ├── preview.ts │ │ │ └── vscode-ui.ts │ │ └── preview-handler.ts │ ├── utils │ │ └── agentic-cli-invocation │ │ └── invoke-agentic-cli.ts │ └── views │ └── prompt │ ├── backend │ │ └── message-handlers │ │ └── handle-response-preview.ts │ └── frontend │ └── Prompt.tsx └── packages └── ui └── src └── components └── editor └── prompt-view ├── ResponsePreview │ └── ResponsePreview.tsx └── ResponsePreviewFooter └── ResponsePreviewFooter.tsx
1 parent 0e0d7fa commit 985fbad

5 files changed

Lines changed: 25 additions & 23 deletions

File tree

apps/editor/src/commands/apply-from-clipboard-command/apply-from-clipboard-command.ts renamed to apps/editor/src/commands/apply-from-clipboard-command.ts

File renamed without changes.

‎apps/editor/src/commands/apply-from-clipboard-command/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/editor/src/commands/apply-from-terminal-command/apply-from-terminal-command.ts renamed to apps/editor/src/commands/apply-from-terminal-command.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { t } from '@/i18n'
88
import {
99
generate_diff_markdown,
1010
get_all_files
11-
} from '../../utils/agentic-cli-invocation/utils/generate-diff-markdown'
11+
} from '../utils/agentic-cli-invocation/utils/generate-diff-markdown'
1212
import { Logger } from '@shared/utils/logger'
1313

1414
const build_diff_from_sandbox = async (
@@ -119,11 +119,15 @@ export const apply_from_terminal_command = (): vscode.Disposable => {
119119
}
120120
} catch {}
121121

122-
await apply_response({
122+
const accepted = await apply_response({
123123
response: diff_markdown,
124124
is_from_agentic_cli: true,
125125
cli_configuration_details
126126
})
127+
128+
if (accepted) {
129+
active_terminal.dispose()
130+
}
127131
} catch (error) {
128132
Logger.error({
129133
function_name: 'apply_from_terminal_command',
@@ -135,8 +139,8 @@ export const apply_from_terminal_command = (): vscode.Disposable => {
135139
)
136140
}
137141
} else {
138-
vscode.window.showErrorMessage(
139-
t('command.apply-from-terminal-command.error.not-cwc-cli')
142+
vscode.window.showInformationMessage(
143+
t('command.apply-from-terminal-command.info.not-cwc-cli')
140144
)
141145
}
142146
}

‎apps/editor/src/commands/apply-from-terminal-command/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎apps/editor/src/i18n/translations/commands/apply-from-terminal-command.ts‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@ export const translations = {
3636
hu: 'Nincs aktív terminál munkamenet.',
3737
bg: 'Няма активна терминална сесия.'
3838
},
39-
'command.apply-from-terminal-command.error.not-cwc-cli': {
40-
en: 'Active terminal is not a CWC CLI session.',
41-
pl: 'Aktywny terminal nie jest sesją CWC CLI.',
42-
'zh-cn': '活动终端不是 CWC CLI 会话。',
43-
ja: 'アクティブなターミナルは CWC CLI セッションではありません。',
44-
'zh-tw': '活動終端不是 CWC CLI 會話。',
45-
de: 'Das aktive Terminal ist keine CWC CLI-Sitzung.',
46-
es: 'La terminal activa no es una sesión de CWC CLI.',
47-
fr: "Le terminal actif n'est pas une session CWC CLI.",
48-
'pt-br': 'O terminal ativo não é uma sessão do CWC CLI.',
49-
ru: 'Активный терминал не является сеансом CWC CLI.',
50-
ko: '활성 터미널이 CWC CLI 세션이 아닙니다.',
51-
it: 'Il terminale attivo non è una sessione CWC CLI.',
52-
tr: 'Aktif terminal bir CWC CLI oturumu değil.',
53-
cs: 'Aktivní terminál není relací CWC CLI.',
54-
hu: 'Az aktív terminál nem egy CWC CLI munkamenet.',
55-
bg: 'Активният терминал не е сесия на CWC CLI.'
39+
'command.apply-from-terminal-command.info.not-cwc-cli': {
40+
en: 'Active terminal is not a CLI edit session.',
41+
pl: 'Aktywny terminal nie jest sesją edycji z CLI.',
42+
'zh-cn': '活动终端不是 CLI 编辑会话。',
43+
ja: 'アクティブなターミナルは CLI 編集セッションではありません。',
44+
'zh-tw': '活動終端機不是 CLI 編輯會話。',
45+
de: 'Das aktive Terminal ist keine CLI-Bearbeitungssitzung.',
46+
es: 'El terminal activo no es una sesión de edición CLI.',
47+
fr: "Le terminal actif n'est pas une session d'édition CLI.",
48+
'pt-br': 'O terminal ativo não é uma sessão de edição da CLI.',
49+
ru: 'Активный терминал не является сеансом редактирования CLI.',
50+
ko: '활성 터미널은 CLI 편집 세션이 아닙니다.',
51+
it: 'Il terminale attivo non è una sessione di modifica CLI.',
52+
tr: 'Aktif terminal bir CLI düzenleme oturumu değil.',
53+
cs: 'Aktivní terminál není relace úprav CLI.',
54+
hu: 'Az aktív terminál nem egy CLI szerkesztési munkamenet.',
55+
bg: 'Активният терминал не е сесия за редактиране на CLI.'
5656
},
5757
'command.apply-from-terminal-command.info.no-changes': {
5858
en: 'No changes found in the terminal sandbox.',

0 commit comments

Comments
 (0)