Phase 007: migrate every remaining view from naive-ui to Arco Design Vue

The project now has exactly one UI library. Every naive-ui component in
packages/client/src is replaced by its Arco equivalent across 24 views and
roughly 80 components, and naive-ui is dropped from package.json along with
its transitive vueuc / @css-render / vdirs / seemly dependencies.

The migration is rendering-layer only. No store logic, no API contract, and
no /chat-run payload was touched.

Three classes of leftover were invisible to `grep naive-ui` and are now
covered by tests/client/no-naive-ui.test.ts, which asserts all three:
  - dead .n-* class names in style blocks
  - dead --n-* custom properties
  - naive-ui in package.json

Notable behavioural traps handled along the way, recorded in
docs/arco-migration-rules.md:
  - a-input-password defaults to masked; passing default-visibility="false"
    would have exposed API keys in clear text
  - a-upload fires a real XHR unless auto-upload is false
  - nested Trigger components fight over the first element child, so the
    group-chat settings dropdown was flattened
  - Arco renders tooltip default-slot text inline, which was silently
    collapsing the chat and group-chat toolbars
This commit is contained in:
2026-10-18 22:57:25 +08:00
parent c3eeea4187
commit 836d0228d2
115 changed files with 4067 additions and 3891 deletions
+28 -21
View File
@@ -1,6 +1,7 @@
// @vitest-environment jsdom
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import ArcoVue from '@arco-design/web-vue'
const mockFetchPendingWrites = vi.hoisted(() => vi.fn())
const mockFetchPendingWriteReview = vi.hoisted(() => vi.fn())
@@ -20,28 +21,20 @@ vi.mock('vue-i18n', () => ({
}),
}))
vi.mock('naive-ui', async () => {
const actual = await vi.importActual<any>('naive-ui')
return {
...actual,
useMessage: () => ({
success: vi.fn(),
error: vi.fn(),
}),
}
})
vi.mock('@/composables/useMessage', () => ({
useMessage: () => ({
success: vi.fn(),
error: vi.fn(),
}),
}))
import PendingWriteApprovals from '@/components/hermes/skills/PendingWriteApprovals.vue'
function mountComponent() {
return mount(PendingWriteApprovals, {
global: {
plugins: [ArcoVue],
stubs: {
NTag: { template: '<span><slot /></span>' },
NButton: {
props: ['loading'],
template: '<button class="n-button" @click="$emit(\'click\')"><slot /></button>',
},
MarkdownRenderer: {
props: ['content'],
template: '<article class="markdown-renderer-stub">{{ content }}</article>',
@@ -51,6 +44,21 @@ function mountComponent() {
})
}
/** Buttons are located by their label, never by DOM order. */
function buttonByText(wrapper: any, text: string) {
const button = wrapper.findAll('button').find((node: any) => node.text().trim() === text)
if (!button) throw new Error(`button not found: ${text}`)
return button
}
/** The pending-write row whose summary matches, so actions never rely on order. */
function itemBySummary(wrapper: any, summary: string) {
const item = wrapper.findAll('.write-approval-item')
.find((node: any) => node.find('.write-approval-summary').text().trim() === summary)
if (!item) throw new Error(`write approval item not found: ${summary}`)
return item
}
describe('PendingWriteApprovals', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -110,12 +118,12 @@ describe('PendingWriteApprovals', () => {
expect(wrapper.text()).toContain('remember concise answers')
expect(wrapper.text()).toContain('patch demo skill')
const approveButtons = () => wrapper.findAll('.n-button').filter(button => button.text() === 'skills.writeApprovalApprove')
const rejectButtons = () => wrapper.findAll('.n-button').filter(button => button.text() === 'skills.writeApprovalReject')
const memoryRow = itemBySummary(wrapper, 'remember concise answers')
const skillsRow = itemBySummary(wrapper, 'patch demo skill')
await approveButtons()[0].trigger('click')
await memoryRow.findAll('button').find(b => b.text() === 'skills.writeApprovalApprove')!.trigger('click')
await flushPromises()
await rejectButtons()[1].trigger('click')
await skillsRow.findAll('button').find(b => b.text() === 'skills.writeApprovalReject')!.trigger('click')
await flushPromises()
expect(mockApprovePendingWrite).toHaveBeenCalledWith('memory', 'mem123')
@@ -152,8 +160,7 @@ describe('PendingWriteApprovals', () => {
const wrapper = mountComponent()
await flushPromises()
const diffButton = wrapper.findAll('.n-button').find(button => button.text() === 'skills.writeApprovalViewDiff')
await diffButton?.trigger('click')
await buttonByText(wrapper, 'skills.writeApprovalViewDiff').trigger('click')
await flushPromises()
expect(mockFetchPendingWriteReview).toHaveBeenCalledWith('skills', 'skill123')