Skip to content

Add standalone preview for the aifilediff block view#3063

Merged
sawka merged 3 commits intomainfrom
copilot/add-frontend-preview-for-aifilediff
Mar 15, 2026
Merged

Add standalone preview for the aifilediff block view#3063
sawka merged 3 commits intomainfrom
copilot/add-frontend-preview-for-aifilediff

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

This adds a frontend/preview entry for aifilediff.tsx, following the same full-block preview pattern used by sysinfo. The preview renders the real block/view stack with mock Wave objects and a mocked diff RPC response so the file diff UI can be exercised in isolation.

  • Preview wiring

    • Added frontend/preview/previews/aifilediff.preview.tsx
    • Creates a mock workspace/tab/block for an aifilediff block
    • Renders the real Block component so header, sizing, and Monaco diff layout behave like an actual block view
  • Mock diff data

    • Added frontend/preview/previews/aifilediff.preview-util.ts
    • Provides default original/modified file contents and a helper to build the mock WaveAIGetToolDiffCommand response
    • Uses a realistic file path and code sample so the diff viewer is immediately useful in preview mode
  • View integration cleanup

    • Updated frontend/app/view/aifilediff/aifilediff.tsx to read RPC/WOS from the injected waveEnv
    • This keeps the view compatible with the preview server’s mock environment instead of depending on the global runtime path
  • Focused preview coverage

    • Added frontend/preview/previews/aifilediff.preview.test.ts
    • Covers the helper that encodes mock diff payloads consumed by the preview
  • Example

    rpc: {
        WaveAIGetToolDiffCommand: async (_client, data) => {
            if (
                data.chatid !== DefaultAiFileDiffChatId ||
                data.toolcallid !== DefaultAiFileDiffToolCallId
            ) {
                return null;
            }
            return makeMockAiFileDiffResponse();
        },
    }
  • screenshot
    aifilediff preview


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 14, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2a0d905
Status: ✅  Deploy successful!
Preview URL: https://c50e76b4.waveterm.pages.dev
Branch Preview URL: https://copilot-add-frontend-preview.waveterm.pages.dev

View logs

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add frontend preview for aifilediff.tsx Add standalone preview for the aifilediff block view Mar 14, 2026
Copilot AI requested a review from sawka March 14, 2026 19:26
@sawka sawka marked this pull request as ready for review March 14, 2026 20:46
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 14, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • frontend/app/view/aifilediff/aifilediff.tsx - Migrated to use WaveEnv pattern
  • frontend/preview/previews/aifilediff.preview-util.ts - New preview utilities
  • frontend/preview/previews/aifilediff.preview.test.ts - New test file
  • frontend/preview/previews/aifilediff.preview.tsx - New preview component

The changes correctly migrate the AiFileDiffView to use the WaveEnv injection pattern, consistent with other views like sysinfo. The RPC calls now use model.env.rpc.WaveAIGetToolDiffCommand instead of the global RpcApi, and the block atom is obtained via this.env.wos.getWaveObjectAtom instead of the global WOS. This follows the established pattern for views that need environment-specific RPC and WOS access.

@sawka sawka merged commit 10fdf42 into main Mar 15, 2026
7 checks passed
@sawka sawka deleted the copilot/add-frontend-preview-for-aifilediff branch March 15, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants