Files
CodeNomad/packages/ui/src/lib/i18n/messages/ru/instance.ts
VooDisss e022a158eb improve delete worktree failure diagnostics (#302)
## Summary
- move delete-worktree failures out of transient toast-only UX and keep
them inline in the delete modal
- add parsed diagnostics for common failure modes, including a short
summary, likely cause, and suggested next step
- make the raw error easier to review and share with raw and sanitized
copy actions

Closes #301.

## BEFORE:

<img width="1127" height="860" alt="image"
src="https://github.com/user-attachments/assets/dd09ba1e-be8c-450c-a1dd-f1cde2a48802"
/>

## AFTER: 

<img width="1384" height="835" alt="image"
src="https://github.com/user-attachments/assets/6b0d1459-21fa-4264-9e54-45540f584538"
/>

## Problem
Before this change, delete-worktree failures were difficult to work
with:

1. The failure message was effectively raw backend or git output.
2. Users had to infer the meaning of the error themselves.
3. The UI did not explain what likely went wrong or what to do next.
4. Sharing the error for debugging was awkward when it included
machine-local absolute paths.
5. The confirmation modal was not being used as the primary diagnostic
surface for a destructive action that frequently fails for
understandable reasons.

This was especially frustrating for common cases such as:
- modified or untracked files in the worktree
- a process still using the worktree directory
- permission errors on Windows
- missing worktree directories or stale worktree records

## What changed

### Modal failure UX
- keep delete failures inline inside
`packages/ui/src/components/worktree-selector.tsx`
- clear modal-local error state when opening or closing the dialog
- keep the success toast on successful deletion, but use the modal
itself for failure presentation

### Human-readable diagnostics
- parse JSON-shaped backend error payloads such as `{"error":"..."}`
before classification
- classify common delete failure patterns into:
  - `localChanges`
  - `inUse`
  - `notFound`
  - `permissionDenied`
  - `unknown`
- render three user-facing lines above the raw error:
  - summary
  - likely cause
  - suggested next step

### Copy flows
- add `Copy error` for the original failure text
- add `Copy sanitized` to redact common absolute path and username
patterns before copying

### Modal content and sizing
- present the target worktree in a simpler two-line summary block
- update the delete description text to plain English: `Deletes this
branch worktree and its local folder.`
- size the delete modal deliberately for desktop use while allowing
vertical expansion to the viewport limit before scrolling

### i18n coverage
- add the new delete diagnostic strings across all currently supported
locales touched by this area:
  - `en`
  - `es`
  - `fr`
  - `he`
  - `ja`
  - `ru`
  - `zh-Hans`

## Why this approach
- It keeps the backend contract unchanged and solves the UX problem
where it occurs.
- It preserves access to the raw failure text instead of hiding
implementation detail entirely.
- It gives users immediate guidance without forcing them to translate
git errors into next actions.
- It improves bug reporting without requiring a separate logging or
export workflow.

## Not included
- server-side preflight guards that block delete when the worktree is
still assigned or in use
- process-aware worktree locking detection
- automatic retry or force-delete-and-retry flows

Those are useful follow-ups, but this PR is intentionally scoped to
failure presentation and debuggability.

## Files changed
- `packages/ui/src/components/worktree-selector.tsx`
- `packages/ui/src/lib/i18n/messages/en/instance.ts`
- `packages/ui/src/lib/i18n/messages/es/instance.ts`
- `packages/ui/src/lib/i18n/messages/fr/instance.ts`
- `packages/ui/src/lib/i18n/messages/he/instance.ts`
- `packages/ui/src/lib/i18n/messages/ja/instance.ts`
- `packages/ui/src/lib/i18n/messages/ru/instance.ts`
- `packages/ui/src/lib/i18n/messages/zh-Hans/instance.ts`

## Validation
- `npm run typecheck --workspace @codenomad/ui`
- `npm run build --workspace @codenomad/ui`
- `npm run typecheck --workspace @neuralnomads/codenomad-electron-app`

## Notes for reviewers
- The error classifier is intentionally heuristic and string-based. It
is meant to improve the common cases without increasing backend
coupling.
- The sanitized copy flow is conservative and focused on path and
username redaction, not full structured log scrubbing.

---------

Co-authored-by: Shantur Rathore <i@shantur.com>
2026-04-17 17:12:17 +01:00

215 lines
18 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export const instanceMessages = {
"instanceTabs.new.title": "Новый экземпляр (Cmd/Ctrl+N)",
"instanceTabs.new.ariaLabel": "Новый экземпляр",
"instanceTabs.remote.title": "Удаленное подключение",
"instanceTabs.remote.ariaLabel": "Удаленное подключение",
"instanceInfo.title": "Информация об экземпляре",
"instanceInfo.labels.folder": "Папка",
"instanceInfo.labels.project": "Проект",
"instanceInfo.labels.versionControl": "Система контроля версий",
"instanceInfo.labels.opencodeVersion": "Версия OpenCode",
"instanceInfo.labels.binaryPath": "Путь к бинарнику",
"instanceInfo.labels.environmentVariables": "Переменные окружения ({count})",
"instanceInfo.loading": "Загрузка…",
"instanceInfo.server.title": "Сервер",
"instanceInfo.server.port": "Порт:",
"instanceInfo.server.pid": "PID:",
"instanceInfo.server.status": "Статус:",
"instanceTab.status.permission": "Ожидание разрешения",
"instanceTab.status.compacting": "Компактация",
"instanceTab.status.working": "Работает",
"instanceTab.status.idle": "Простой",
"instanceTab.status.ariaLabel": "Статус экземпляра: {status}",
"instanceTab.actions.close.ariaLabel": "Закрыть экземпляр",
"instanceShell.leftPanel.sessionsTitle": "Сессии",
"instanceShell.leftPanel.instanceInfo": "Информация об экземпляре",
"instanceShell.leftDrawer.pin": "Закрепить левую панель",
"instanceShell.leftDrawer.unpin": "Открепить левую панель",
"instanceShell.leftDrawer.toggle.pinned": "Левая панель закреплена",
"instanceShell.leftDrawer.toggle.open": "Открыть левую панель",
"instanceShell.leftDrawer.toggle.close": "Закрыть левую панель",
"instanceShell.rightDrawer.pin": "Закрепить правую панель",
"instanceShell.rightDrawer.unpin": "Открепить правую панель",
"instanceShell.rightDrawer.toggle.pinned": "Правая панель закреплена",
"instanceShell.rightDrawer.toggle.open": "Открыть правую панель",
"instanceShell.rightDrawer.toggle.close": "Закрыть правую панель",
"instanceShell.fullscreen.enter": "Полный экран",
"instanceShell.fullscreen.exit": "Выйти из полного экрана",
"instanceShell.metrics.usedLabel": "Использовано",
"instanceShell.metrics.availableLabel": "Доступно",
"instanceShell.commandPalette.openAriaLabel": "Открыть палитру команд",
"instanceShell.commandPalette.button": "Палитра команд",
"instanceShell.connection.ariaLabel": "Соединение {status}",
"instanceShell.connection.connected": "Подключено",
"instanceShell.connection.connecting": "Подключение…",
"instanceShell.connection.disconnected": "Отключено",
"instanceShell.connection.unknown": "Неизвестно",
"instanceWelcome.shortcuts.newSession": "Новая сессия",
"instanceWelcome.empty.title": "Нет предыдущих сессий",
"instanceWelcome.empty.description": "Создайте новую сессию ниже, чтобы начать",
"instanceWelcome.loading.title": "Загрузка сессий",
"instanceWelcome.loading.description": "Получаем ваши предыдущие сессии…",
"instanceWelcome.resume.title": "Продолжить сессию",
"instanceWelcome.resume.subtitle.one": "{count} сессия доступна",
"instanceWelcome.resume.subtitle.other": "{count} сессий доступно",
"instanceWelcome.session.untitled": "Сессия без названия",
"instanceWelcome.new.title": "Начать новую сессию",
"instanceWelcome.new.subtitle": "Мы автоматически используем последнего агента/модель",
"instanceWelcome.new.createButton": "Создать сессию",
"instanceWelcome.overlay.close": "Закрыть",
"instanceWelcome.actions.viewInstanceInfo": "Показать информацию об экземпляре",
"instanceWelcome.actions.renameTitle": "Переименовать сессию",
"instanceWelcome.actions.deleteTitle": "Удалить сессию",
"instanceWelcome.hints.navigate": "Навигация",
"instanceWelcome.hints.jump": "Перейти",
"instanceWelcome.hints.firstLast": "Первый/последний",
"instanceWelcome.hints.resume": "Продолжить",
"instanceWelcome.hints.delete": "Удалить",
"instanceWelcome.toasts.renameError": "Не удалось переименовать сессию",
"instanceDisconnected.title": "Экземпляр отключен",
"instanceDisconnected.folderFallback": "это рабочее пространство",
"instanceDisconnected.reasonFallback": "Сервер перестал отвечать",
"instanceDisconnected.description": "{folder} больше недоступно. Закройте вкладку, чтобы продолжить работу.",
"instanceDisconnected.details.title": "Подробности",
"instanceDisconnected.details.folderLabel": "Папка:",
"instanceDisconnected.actions.closeInstance": "Закрыть экземпляр",
"instanceShell.empty.title": "Сессия не выбрана",
"instanceShell.empty.description": "Выберите сессию, чтобы просмотреть сообщения",
"instanceShell.rightPanel.title": "Панель состояния",
"instanceShell.rightPanel.tabs.changes": "Изменения",
"instanceShell.rightPanel.tabs.gitChanges": "Изменения Git",
"instanceShell.rightPanel.tabs.files": "Файлы",
"instanceShell.rightPanel.tabs.status": "Статус",
"instanceShell.rightPanel.tabs.ariaLabel": "Вкладки правой панели",
"instanceShell.rightPanel.actions.refresh": "Обновить",
"instanceShell.rightPanel.actions.save": "Сохранить (Ctrl+S)",
"instanceShell.rightPanel.actions.saveConfirm.message": "Сохранить изменения в \"{path}\" перед переключением?",
"instanceShell.rightPanel.actions.saveConfirm.confirmLabel": "Сохранить",
"instanceShell.rightPanel.actions.saveConfirm.cancelLabel": "Отменить изменения",
"instanceShell.rightPanel.actions.conflict.message": "Файл был изменён агентом. Перезаписать изменения агента?",
"instanceShell.rightPanel.actions.conflict.confirmLabel": "Перезаписать",
"instanceShell.rightPanel.actions.conflict.cancelLabel": "Отмена",
"instanceShell.rightPanel.actions.refreshDirty.message": "Файл имеет несохранённые изменения. Обновление отменит ваши правки. Продолжить?",
"instanceShell.rightPanel.actions.refreshDirty.confirmLabel": "Обновить",
"instanceShell.rightPanel.actions.refreshDirty.cancelLabel": "Отмена",
"instanceShell.rightPanel.toast.saveSuccess": "Файл успешно сохранён",
"instanceShell.rightPanel.toast.saveError": "Не удалось сохранить файл",
"instanceShell.rightPanel.sections.yoloMode": "Режим Yolo",
"instanceShell.rightPanel.sections.yoloMode.tooltip": "Автоматически одобряет запросы разрешений для текущей сессии. Включайте только если доверяете запускаемым инструментам.",
"instanceShell.rightPanel.sections.sessionChanges": "Изменения сессии",
"instanceShell.rightPanel.sections.sessionChanges.tooltip": "Файлы, измененные в текущей сессии. Показывает добавления и удаления для каждого файла.",
"instanceShell.rightPanel.sections.plan": "План",
"instanceShell.rightPanel.sections.plan.tooltip": "Дорожная карта агента для этой сессии. Отслеживает задачи и их статус выполнения.",
"instanceShell.rightPanel.sections.backgroundProcesses": "Фоновые оболочки",
"instanceShell.rightPanel.sections.backgroundProcesses.tooltip": "Долгоработающие процессы, запущенные агентом. Вы можете следить за их выводом, останавливать или завершать их.",
"instanceShell.rightPanel.sections.mcp": "MCP-серверы",
"instanceShell.rightPanel.sections.mcp.tooltip": "Серверы протокола Model Context Protocol, расширяющие возможности агента внешними инструментами.",
"instanceShell.rightPanel.sections.lsp": "LSP-серверы",
"instanceShell.rightPanel.sections.lsp.tooltip": "Серверы протокола Language Server Protocol, обеспечивающие интеллектуальную поддержку кода и диагностику.",
"instanceShell.rightPanel.sections.plugins": "Плагины",
"instanceShell.rightPanel.sections.plugins.tooltip": "Плагины, настраивающие поведение интерфейса и сервера, добавляющие функции поверх MCP и LSP.",
"instanceShell.sessionChanges.noSessionSelected": "Выберите сессию, чтобы просмотреть изменения.",
"instanceShell.sessionChanges.loading": "Загрузка изменений...",
"instanceShell.sessionChanges.empty": "Пока нет изменений.",
"instanceShell.sessionChanges.filesChanged": "Изменено файлов: {count}",
"instanceShell.sessionChanges.actions.show": "Показать изменения",
"instanceShell.gitChanges.loading": "Загрузка изменений Git...",
"instanceShell.gitChanges.empty": "Изменений Git пока нет.",
"instanceShell.gitChanges.deleted": "Удалено",
"instanceShell.gitChanges.binaryViewer": "Невозможно показать бинарный файл",
"instanceShell.gitChanges.sections.staged": "Подготовленные изменения",
"instanceShell.gitChanges.sections.unstaged": "Изменения",
"instanceShell.gitChanges.actions.insertContext": "Добавить в промпт",
"instanceShell.gitChanges.actions.stage": "Подготовить файл",
"instanceShell.gitChanges.actions.unstage": "Убрать из staging",
"instanceShell.gitChanges.commit.placeholder": "Введите сообщение коммита",
"instanceShell.gitChanges.commit.submit": "Commit",
"instanceShell.gitChanges.commit.submitting": "Создание commit...",
"instanceShell.gitChanges.commit.success": "Commit успешно создан",
"instanceShell.gitChanges.commit.error": "Не удалось создать commit",
"instanceShell.filesShell.fileListTitle": "Список файлов",
"instanceShell.filesShell.mobileSelectorLabel": "Выбрать файл",
"instanceShell.filesShell.mobileSelectorEmpty": "Выберите файл",
"instanceShell.filesShell.viewerTitle": "Просмотр изменений",
"instanceShell.filesShell.viewerPlaceholder": "Подробный рендер изменений будет добавлен на следующем этапе.",
"instanceShell.filesShell.viewerEmpty": "Файл не выбран.",
"instanceShell.plan.noSessionSelected": "Выберите сессию, чтобы просмотреть план.",
"instanceShell.plan.empty": "Пока ничего не запланировано.",
"instanceShell.yoloMode.noSessionSelected": "Выберите сессию, чтобы настроить режим Yolo.",
"instanceShell.yoloMode.title": "Режим Yolo",
"instanceShell.yoloMode.description": "Автоматически одобряет запросы разрешений для этой сессии. По умолчанию выключен.",
"instanceShell.yoloMode.badge": "Yolo",
"instanceShell.yoloMode.badgeAriaLabel": "Режим Yolo включен",
"instanceShell.backgroundProcesses.empty": "Нет фоновых процессов.",
"instanceShell.backgroundProcesses.status": "Статус: {status}",
"instanceShell.backgroundProcesses.output": "Вывод: {sizeKb}KB",
"instanceShell.backgroundProcesses.notify.enabled": "Уведомление о завершении включено",
"instanceShell.backgroundProcesses.notify.disabled": "Уведомление о завершении выключено",
"instanceShell.backgroundProcesses.actions.output": "Вывод",
"instanceShell.backgroundProcesses.actions.stop": "Остановить",
"instanceShell.backgroundProcesses.actions.terminate": "Завершить",
"instanceShell.worktree.delete.error.title": "Удаление не удалось",
"instanceShell.worktree.delete.error.fallback": "Не удалось удалить worktree",
"instanceShell.worktree.delete.error.causeLabel": "Вероятная причина:",
"instanceShell.worktree.delete.error.nextStepLabel": "Рекомендуемый следующий шаг:",
"instanceShell.worktree.delete.error.summary.localChanges": "Git отказался удалять этот worktree, потому что в нем есть измененные или неотслеживаемые файлы.",
"instanceShell.worktree.delete.error.summary.inUse": "CodeNomad не смог удалить этот worktree, потому что что-то все еще использует файлы в каталоге.",
"instanceShell.worktree.delete.error.summary.notFound": "CodeNomad не смог удалить этот worktree, потому что каталог или запись worktree не найдены.",
"instanceShell.worktree.delete.error.summary.permissionDenied": "CodeNomad не смог удалить этот worktree, потому что доступ к каталогу был запрещен.",
"instanceShell.worktree.delete.error.summary.unknown": "CodeNomad не смог удалить этот worktree.",
"instanceShell.worktree.delete.error.cause.localChanges": "Локальные изменения",
"instanceShell.worktree.delete.error.cause.inUse": "Другой процесс использует этот worktree",
"instanceShell.worktree.delete.error.cause.notFound": "Каталог или запись worktree отсутствуют",
"instanceShell.worktree.delete.error.cause.permissionDenied": "Недостаточно прав файловой системы",
"instanceShell.worktree.delete.error.cause.unknown": "Бэкенд вернул неклассифицированную ошибку удаления",
"instanceShell.worktree.delete.error.nextStep.localChanges": "Включите принудительное удаление, если хотите отбросить локальные изменения, либо очистите worktree и попробуйте снова.",
"instanceShell.worktree.delete.error.nextStep.inUse": "Закройте терминалы, редакторы, watcher-процессы или фоновые процессы, использующие этот worktree, и попробуйте снова.",
"instanceShell.worktree.delete.error.nextStep.notFound": "Обновите список worktree и попробуйте снова. Если ошибка сохранится, проверьте путь worktree на диске.",
"instanceShell.worktree.delete.error.nextStep.permissionDenied": "Проверьте права файловой системы и закройте приложения, которые могут удерживать этот каталог, затем попробуйте снова.",
"instanceShell.worktree.delete.error.nextStep.unknown": "Посмотрите необработанную ошибку ниже, затем попробуйте снова после устранения указанной проблемы.",
"instanceShell.worktree.delete.error.copyRaw": "Копировать ошибку",
"instanceShell.worktree.delete.error.copySanitized": "Копировать обезличенную",
"instanceShell.worktree.delete.error.copySuccess": "Ошибка удаления скопирована",
"instanceShell.worktree.delete.error.copySanitizedSuccess": "Обезличенная ошибка удаления скопирована",
"instanceShell.worktree.delete.error.copyFailure": "Не удалось скопировать ошибку удаления",
"versionPill.appWithVersion": "Приложение {version}",
"versionPill.ui": "UI",
"versionPill.uiWithVersion": "UI {version}",
"versionPill.source": " ({source})",
"opencodeBinarySelector.title": "Бинарник OpenCode",
"opencodeBinarySelector.subtitle": "Выберите, какой исполняемый файл OpenCode запускать",
"opencodeBinarySelector.customPath.placeholder": "Введите путь к бинарнику opencode…",
"opencodeBinarySelector.actions.add": "Добавить",
"opencodeBinarySelector.actions.browse": "Выбрать бинарник…",
"opencodeBinarySelector.actions.removeTitle": "Удалить бинарник",
"opencodeBinarySelector.badge.systemPath": "Использовать бинарник из системного PATH",
"opencodeBinarySelector.status.checkingVersions": "Проверка версий…",
"opencodeBinarySelector.status.checking": "Проверка…",
"opencodeBinarySelector.dialog.title": "Выберите бинарник OpenCode",
"opencodeBinarySelector.dialog.description": "Просматривайте файлы, доступные через CLI-сервер.",
"opencodeBinarySelector.validation.invalidBinary": "Неверный бинарник OpenCode",
"opencodeBinarySelector.validation.alreadyValidating": "Проверка уже выполняется",
"opencodeBinarySelector.display.systemPath": "{name} (system PATH)",
"opencodeBinarySelector.versionLabel": "v{version}",
} as const