Repository navigation
feat(explain): save raw plan output to file (#1162) - #1178
markankamaransheogarat-sys wants to merge 3 commits into
Conversation
- add getRawExplainExtension and getRawExplainFileOptions to pick json/xml/txt extensions - add saveRawExplainOutput helper to prompt native file save dialog and write original raw_output - add 'Save raw plan…' button to the raw EXPLAIN view in VisualExplainView - synchronously capture plan snapshot before awaiting dialog so later queries cannot replace exported content - disable save button when raw_output is unavailable - handle user cancellation without error and alert on write failure - add localized translations across all 11 supported locales - add unit tests in tests/utils/explainRaw.test.ts and component tests in tests/components/explain/VisualExplainView.test.tsx
| <div className="flex flex-col h-full min-h-0"> | ||
| <div className="flex items-center justify-between px-4 py-2 border-b border-default bg-base/40"> | ||
| <span className="text-xs font-mono uppercase text-muted"> | ||
| {rawLanguage} |
There was a problem hiding this comment.
SUGGESTION: Internal language identifier rendered as user-facing text
rawLanguage is a Monaco language id ("json" | "xml" | "plaintext"), so the new header badge shows the literal, non-localized string PLAINTEXT for plain-text plans. The i18n rule requires user-visible strings to go through t(). Either drop the badge (the save button is the only functional element in this bar) or map the language to a localized label, e.g. a editor.visualExplain.rawFormat.* key set added to all locales.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Notes
Files Reviewed (2 files in incremental diff)
Previous Review Summaries (2 snapshots, latest commit 0ade37e)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0ade37e)Status: 1 Issue Found | Recommendation: Merge after considering the suggestion Overview
Issue Details (click to expand)SUGGESTION
Notes
Fix these issues in Kilo Cloud Files Reviewed (15 files)
Previous review (commit 5f58019)Status: 1 Issue Found | Recommendation: Merge after considering the suggestion Overview
Issue Details (click to expand)SUGGESTION
Notes
Fix these issues in Kilo Cloud Files Reviewed (15 files)
Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 1.2K · Cached: 186.7K Review guidance: REVIEW.md from base branch |
- add getRawExplainFormatLabel helper in explainRaw.ts - render localized Text format badge instead of internal PLAINTEXT language id - add formatText translations across all 11 locales
Preview buildThe preview build of commit |
| * Return a clean user-facing format label for a raw EXPLAIN payload. | ||
| * "json" maps to "JSON", "xml" to "XML", and "plaintext" to "Text". | ||
| */ | ||
| export function getRawExplainFormatLabel(language: RawExplainLanguage): string { |
There was a problem hiding this comment.
SUGGESTION: Unused helper duplicates inline logic
getRawExplainFormatLabel is only referenced by its own unit tests; VisualExplainView re-implements the same json/xml/plaintext switch inline (with a localized Text label). The tests therefore cover a function that production code never calls, while the real, localized mapping in the component is untested. Remove this helper and its tests, or move the mapping here (e.g. return a key/fallback pair that the component passes to t()) so there is a single source of truth.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Closes #1162
Summary
Adds "Save raw plan…" action to the raw EXPLAIN view in
VisualExplainView, allowing users to directly save the originalraw_outputto a file without manual copy-pasting or re-running queries.Details & Acceptance Criteria
detectRawExplainLanguagevia newgetRawExplainExtensionandgetRawExplainFileOptionshelpers to automatically default to.jsonfor JSON plans,.xmlfor SHOWPLAN XML, and.txtfor plaintext output.raw_outputverbatim without reformatting or re-running EXPLAIN.plan?.raw_outputbefore awaiting the save dialog, preventing subsequent queries from overriding the exported content.raw_outputis absent or while save is in progress. Handles user cancellation without errors, logs and alerts on write failures. Complies with jsx-a11y and theme token styling rules.saveRawPlanandsaveRawErrorkeys across all 11 supported locales.tests/utils/explainRaw.test.tsand component interaction test coverage intests/components/explain/VisualExplainView.test.tsx.