@dyyz1993/create-agent 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/__tests__/cli.test.ts +2 -0
- package/src/__tests__/copy.test.ts +110 -122
- package/src/__tests__/create-args.test.ts +113 -0
- package/src/__tests__/templates.test.ts +29 -3
- package/src/__tests__/update.test.ts +129 -0
- package/src/cli.ts +30 -32
- package/src/commands/create.ts +83 -24
- package/src/commands/update.ts +174 -0
- package/src/commands/workspace.ts +26 -6
- package/src/lib/copy.ts +233 -93
- package/src/lib/templates.ts +12 -0
- package/templates/agent/.husky/commit-msg +4 -0
- package/templates/agent/.husky/pre-commit +11 -0
- package/templates/agent/.husky/pre-push +6 -0
- package/templates/agent/.prettierignore +6 -0
- package/templates/agent/.prettierrc +9 -0
- package/templates/agent/CHANGELOG.md +15 -0
- package/templates/agent/commitlint.config.js +8 -0
- package/templates/agent/package.json +19 -4
- package/templates/agent/src/gateway/__tests__/ws-handler-token.test.ts +53 -39
- package/templates/agent/src/mainview/App.tsx +14 -12
- package/templates/agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +194 -190
- package/templates/agent/src/mainview/components/bash/BashPanel.tsx +210 -189
- package/templates/agent/src/mainview/components/chat/ChatPanel.tsx +45 -20
- package/templates/agent/src/mainview/components/common/ThemeToggle.tsx +41 -21
- package/templates/agent/src/mainview/components/debug/DebugPanel.tsx +181 -114
- package/templates/agent/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +80 -80
- package/templates/agent/src/mainview/components/diff/__tests__/DiffViewerPanel.test.tsx +61 -58
- package/templates/agent/src/mainview/components/feed/FeedPanel.tsx +43 -41
- package/templates/agent/src/mainview/components/file-preview/FilePreviewOverlay.tsx +69 -50
- package/templates/agent/src/mainview/components/file-preview/VirtualizedCodeView.tsx +31 -18
- package/templates/agent/src/mainview/components/git/GitPanel.tsx +731 -490
- package/templates/agent/src/mainview/components/git/__tests__/GitPanel.test.tsx +157 -139
- package/templates/agent/src/mainview/components/layout/AppLayout.tsx +210 -161
- package/templates/agent/src/mainview/components/layout/__tests__/AppLayout.test.tsx +130 -122
- package/templates/agent/src/mainview/components/rules/RulesPanel.tsx +119 -109
- package/templates/agent/src/mainview/components/search/SearchPanel.tsx +123 -117
- package/templates/agent/src/mainview/components/search/__tests__/SearchPanel.test.tsx +64 -44
- package/templates/agent/src/mainview/components/sidebar/__tests__/PinButton.test.tsx +38 -38
- package/templates/agent/src/mainview/components/todo/TodoPanel.tsx +40 -38
- package/templates/agent/src/mainview/components/todo/__tests__/TodoPanel.test.tsx +72 -72
- package/templates/agent/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/agent/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/agent/src/mainview/stores/use-app-store.ts +96 -86
- package/templates/agent/src/mainview/stores/use-explorer-store.ts +292 -275
- package/templates/agent/src/mainview/types/index.ts +23 -22
- package/templates/agent/src/mainview/utils/file-icon.tsx +17 -21
- package/templates/agent/src/shared/handlers/chat.ts +53 -53
- package/templates/agent/src/shared/handlers/debug.ts +13 -3
- package/templates/browser-agent/.env.example +19 -0
- package/templates/browser-agent/.husky/commit-msg +4 -0
- package/templates/browser-agent/.husky/pre-commit +11 -0
- package/templates/browser-agent/.husky/pre-push +6 -0
- package/templates/browser-agent/.prettierignore +6 -0
- package/templates/browser-agent/.prettierrc +9 -0
- package/templates/browser-agent/AGENTS.md +396 -0
- package/templates/browser-agent/CHANGELOG.md +15 -0
- package/templates/browser-agent/LICENSE +21 -0
- package/templates/browser-agent/README.md +103 -0
- package/templates/browser-agent/commitlint.config.js +8 -0
- package/templates/browser-agent/electrobun.config.ts +27 -0
- package/templates/browser-agent/electron/main.js +46 -0
- package/templates/browser-agent/electron/preload.js +5 -0
- package/templates/browser-agent/electron-builder.json +40 -0
- package/templates/browser-agent/eslint.config.mjs +79 -0
- package/templates/browser-agent/llms.txt +24 -0
- package/templates/browser-agent/package.json +140 -0
- package/templates/browser-agent/postcss.config.js +6 -0
- package/templates/browser-agent/scripts/dev.ts +138 -0
- package/templates/browser-agent/src/__tests__/hybrid-mode.test.ts +126 -0
- package/templates/browser-agent/src/__tests__/server-config-security.test.ts +55 -0
- package/templates/browser-agent/src/__tests__/server-config.test.ts +59 -0
- package/templates/browser-agent/src/bun/index.ts +130 -0
- package/templates/browser-agent/src/bun/three.d.ts +1 -0
- package/templates/browser-agent/src/gateway/http-routes.ts +1 -0
- package/templates/browser-agent/src/gateway/ipc-transport.ts +68 -0
- package/templates/browser-agent/src/gateway/sse-transport.ts +221 -0
- package/templates/browser-agent/src/mainview/App.tsx +45 -0
- package/templates/browser-agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
- package/templates/browser-agent/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
- package/templates/browser-agent/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
- package/templates/browser-agent/src/mainview/__tests__/setup.ts +40 -0
- package/templates/browser-agent/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
- package/templates/browser-agent/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
- package/templates/browser-agent/src/mainview/__tests__/theme-variables.test.ts +36 -0
- package/templates/browser-agent/src/mainview/components/assets/AssetsPanel.tsx +139 -0
- package/templates/browser-agent/src/mainview/components/chat/ChatPanel.tsx +219 -0
- package/templates/browser-agent/src/mainview/components/chat/CommandBar.tsx +184 -0
- package/templates/browser-agent/src/mainview/components/chat/MessageBubble.tsx +249 -0
- package/templates/browser-agent/src/mainview/components/chat/ToolPicker.tsx +115 -0
- package/templates/browser-agent/src/mainview/components/common/ErrorBoundary.tsx +1 -0
- package/templates/browser-agent/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
- package/templates/browser-agent/src/mainview/components/common/ThemeToggle.tsx +45 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
- package/templates/browser-agent/src/mainview/components/dev/NetworkPanel.tsx +155 -0
- package/templates/browser-agent/src/mainview/components/layout/AppLayout.tsx +311 -0
- package/templates/browser-agent/src/mainview/components/onboarding/SetupWizard.tsx +310 -0
- package/templates/browser-agent/src/mainview/components/process/ProcessPanel.tsx +329 -0
- package/templates/browser-agent/src/mainview/components/sidebar/SessionSidebar.tsx +122 -0
- package/templates/browser-agent/src/mainview/components/sidebar/SkillSidebar.tsx +115 -0
- package/templates/browser-agent/src/mainview/components/topbar/TopBar.tsx +350 -0
- package/templates/browser-agent/src/mainview/global.d.ts +13 -0
- package/templates/browser-agent/src/mainview/hooks/__tests__/use-breakpoint.test.ts +151 -0
- package/templates/browser-agent/src/mainview/hooks/use-agent-chat.ts +157 -0
- package/templates/browser-agent/src/mainview/hooks/use-breakpoint.ts +68 -0
- package/templates/browser-agent/src/mainview/hooks/use-rpc-init.ts +71 -0
- package/templates/browser-agent/src/mainview/hooks/use-sidebar-resize.ts +40 -0
- package/templates/browser-agent/src/mainview/index.css +71 -0
- package/templates/browser-agent/src/mainview/index.html +12 -0
- package/templates/browser-agent/src/mainview/lib/api-client.ts +397 -0
- package/templates/browser-agent/src/mainview/lib/i18n/index.ts +30 -0
- package/templates/browser-agent/src/mainview/lib/i18n/locales/en.json +130 -0
- package/templates/browser-agent/src/mainview/lib/i18n/locales/zh.json +128 -0
- package/templates/browser-agent/src/mainview/lib/network-bus.ts +92 -0
- package/templates/browser-agent/src/mainview/lib/rpc-cache.ts +94 -0
- package/templates/browser-agent/src/mainview/main.tsx +18 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
- package/templates/browser-agent/src/mainview/stores/message-batcher.ts +25 -0
- package/templates/browser-agent/src/mainview/stores/use-asset-store.ts +65 -0
- package/templates/browser-agent/src/mainview/stores/use-chat-store.ts +200 -0
- package/templates/browser-agent/src/mainview/stores/use-connection-store.ts +173 -0
- package/templates/browser-agent/src/mainview/stores/use-locale-store.ts +27 -0
- package/templates/browser-agent/src/mainview/stores/use-log-store.ts +16 -0
- package/templates/browser-agent/src/mainview/stores/use-network-panel-store.ts +18 -0
- package/templates/browser-agent/src/mainview/stores/use-record-store.ts +147 -0
- package/templates/browser-agent/src/mainview/stores/use-session-store.ts +151 -0
- package/templates/browser-agent/src/mainview/stores/use-sidebar-store.ts +161 -0
- package/templates/browser-agent/src/mainview/stores/use-theme-store.ts +46 -0
- package/templates/browser-agent/src/mainview/stores/use-view-store.ts +20 -0
- package/templates/browser-agent/src/mainview/types/index.ts +6 -0
- package/templates/browser-agent/src/server-config.ts +45 -0
- package/templates/browser-agent/src/server.ts +78 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
- package/templates/browser-agent/src/shared/handlers/browser.ts +596 -0
- package/templates/browser-agent/src/shared/handlers/chat.ts +213 -0
- package/templates/browser-agent/src/shared/handlers/file.ts +99 -0
- package/templates/browser-agent/src/shared/handlers/index.ts +7 -0
- package/templates/browser-agent/src/shared/handlers/session.ts +167 -0
- package/templates/browser-agent/src/shared/handlers/system.ts +27 -0
- package/templates/browser-agent/src/shared/handlers/timer.ts +34 -0
- package/templates/browser-agent/src/shared/http-routes.ts +437 -0
- package/templates/browser-agent/src/shared/lib/__tests__/logger.test.ts +92 -0
- package/templates/browser-agent/src/shared/lib/__tests__/path-security.test.ts +77 -0
- package/templates/browser-agent/src/shared/lib/__tests__/web-server.test.ts +203 -0
- package/templates/browser-agent/src/shared/lib/agent.ts +384 -0
- package/templates/browser-agent/src/shared/lib/cdp.ts +448 -0
- package/templates/browser-agent/src/shared/lib/generate.ts +111 -0
- package/templates/browser-agent/src/shared/lib/logger.ts +152 -0
- package/templates/browser-agent/src/shared/lib/mock-stream.ts +147 -0
- package/templates/browser-agent/src/shared/lib/path-security.ts +38 -0
- package/templates/browser-agent/src/shared/lib/port-registry.ts +103 -0
- package/templates/browser-agent/src/shared/lib/web-server.ts +127 -0
- package/templates/browser-agent/src/shared/lib/xhs-extract.ts +71 -0
- package/templates/browser-agent/src/shared/modules/browser.ts +86 -0
- package/templates/browser-agent/src/shared/modules/chat.ts +20 -0
- package/templates/browser-agent/src/shared/modules/file.ts +40 -0
- package/templates/browser-agent/src/shared/modules/session.ts +55 -0
- package/templates/browser-agent/src/shared/modules/system.ts +8 -0
- package/templates/browser-agent/src/shared/modules/timer.ts +11 -0
- package/templates/browser-agent/src/shared/register-all-handlers.ts +36 -0
- package/templates/browser-agent/src/shared/rpc-schema.ts +34 -0
- package/templates/browser-agent/tailwind.config.js +15 -0
- package/templates/browser-agent/tsconfig.ipc.json +14 -0
- package/templates/browser-agent/tsconfig.json +36 -0
- package/templates/browser-agent/vite.config.ts +3 -0
- package/templates/browser-agent/vitest.config.ts +3 -0
- package/templates/chat/.husky/commit-msg +4 -0
- package/templates/chat/.husky/pre-commit +11 -0
- package/templates/chat/.husky/pre-push +6 -0
- package/templates/chat/CHANGELOG.md +15 -0
- package/templates/chat/commitlint.config.js +8 -0
- package/templates/chat/package.json +19 -4
- package/templates/chat/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
- package/templates/chat/src/mainview/__tests__/setup.ts +32 -29
- package/templates/chat/src/mainview/components/chat/ChatPanel.tsx +80 -55
- package/templates/chat/src/mainview/components/common/ThemeToggle.tsx +40 -20
- package/templates/chat/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/chat/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/chat/src/shared/handlers/chat.ts +17 -19
- package/templates/chat/src/shared/handlers/debug.ts +12 -2
- package/templates/cowork/.env.example +8 -0
- package/templates/cowork/.prettierignore +6 -0
- package/templates/cowork/.prettierrc +9 -0
- package/templates/cowork/AGENTS.md +236 -0
- package/templates/cowork/CHANGELOG.md +15 -0
- package/templates/cowork/LICENSE +21 -0
- package/templates/cowork/README.md +103 -0
- package/templates/cowork/commitlint.config.js +8 -0
- package/templates/cowork/docs/CODE-VIEW-PLAN.md +637 -0
- package/templates/cowork/docs/CODE-VIEW-V2.md +196 -0
- package/templates/cowork/docs/CODE-VIEW-V4.md +150 -0
- package/templates/cowork/electrobun.config.ts +27 -0
- package/templates/cowork/eslint.config.mjs +79 -0
- package/templates/cowork/llms.txt +24 -0
- package/templates/cowork/package.json +87 -0
- package/templates/cowork/postcss.config.js +6 -0
- package/templates/cowork/scripts/dev.ts +138 -0
- package/templates/cowork/src/__tests__/hybrid-mode.test.ts +126 -0
- package/templates/cowork/src/__tests__/server-config-security.test.ts +55 -0
- package/templates/cowork/src/__tests__/server-config.test.ts +59 -0
- package/templates/cowork/src/bun/index.ts +130 -0
- package/templates/cowork/src/bun/three.d.ts +1 -0
- package/templates/cowork/src/gateway/http-routes.ts +1 -0
- package/templates/cowork/src/gateway/ipc-transport.ts +68 -0
- package/templates/cowork/src/gateway/sse-transport.ts +231 -0
- package/templates/cowork/src/mainview/App.tsx +45 -0
- package/templates/cowork/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
- package/templates/cowork/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
- package/templates/cowork/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
- package/templates/cowork/src/mainview/__tests__/setup.ts +40 -0
- package/templates/cowork/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
- package/templates/cowork/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
- package/templates/cowork/src/mainview/__tests__/theme-variables.test.ts +36 -0
- package/templates/cowork/src/mainview/components/chat/TaskChat.tsx +311 -0
- package/templates/cowork/src/mainview/components/chat/__tests__/localhost-links.test.ts +76 -0
- package/templates/cowork/src/mainview/components/common/ErrorBoundary.tsx +1 -0
- package/templates/cowork/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
- package/templates/cowork/src/mainview/components/common/ThemeToggle.tsx +45 -0
- package/templates/cowork/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
- package/templates/cowork/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
- package/templates/cowork/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
- package/templates/cowork/src/mainview/components/dev/NetworkPanel.tsx +155 -0
- package/templates/cowork/src/mainview/components/layout/AppLayout.tsx +216 -0
- package/templates/cowork/src/mainview/components/right/ArtifactsPanel.tsx +54 -0
- package/templates/cowork/src/mainview/components/right/ContextPanel.tsx +133 -0
- package/templates/cowork/src/mainview/components/right/ElementPicker.tsx +206 -0
- package/templates/cowork/src/mainview/components/right/PreviewBlock.tsx +155 -0
- package/templates/cowork/src/mainview/components/right/ProgressPanel.tsx +85 -0
- package/templates/cowork/src/mainview/components/sidebar/TaskSidebar.tsx +211 -0
- package/templates/cowork/src/mainview/components/topbar/TopBar.tsx +86 -0
- package/templates/cowork/src/mainview/global.d.ts +13 -0
- package/templates/cowork/src/mainview/hooks/__tests__/use-breakpoint.test.ts +123 -0
- package/templates/cowork/src/mainview/hooks/use-breakpoint.ts +53 -0
- package/templates/cowork/src/mainview/hooks/use-rpc-init.ts +26 -0
- package/templates/cowork/src/mainview/hooks/use-sidebar-resize.ts +40 -0
- package/templates/cowork/src/mainview/index.css +89 -0
- package/templates/cowork/src/mainview/index.html +12 -0
- package/templates/cowork/src/mainview/lib/api-client.ts +404 -0
- package/templates/cowork/src/mainview/lib/i18n/index.ts +30 -0
- package/templates/cowork/src/mainview/lib/i18n/locales/en.json +130 -0
- package/templates/cowork/src/mainview/lib/i18n/locales/zh.json +128 -0
- package/templates/cowork/src/mainview/lib/network-bus.ts +92 -0
- package/templates/cowork/src/mainview/lib/rpc-cache.ts +94 -0
- package/templates/cowork/src/mainview/main.tsx +18 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-preview-store.test.ts +193 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-sidebar-store.test.ts +81 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
- package/templates/cowork/src/mainview/stores/message-batcher.ts +25 -0
- package/templates/cowork/src/mainview/stores/use-chat-store.ts +198 -0
- package/templates/cowork/src/mainview/stores/use-connection-store.ts +168 -0
- package/templates/cowork/src/mainview/stores/use-context-store.ts +68 -0
- package/templates/cowork/src/mainview/stores/use-locale-store.ts +27 -0
- package/templates/cowork/src/mainview/stores/use-log-store.ts +16 -0
- package/templates/cowork/src/mainview/stores/use-network-panel-store.ts +18 -0
- package/templates/cowork/src/mainview/stores/use-output-store.ts +47 -0
- package/templates/cowork/src/mainview/stores/use-preview-store.ts +97 -0
- package/templates/cowork/src/mainview/stores/use-sidebar-store.ts +272 -0
- package/templates/cowork/src/mainview/stores/use-task-store.ts +86 -0
- package/templates/cowork/src/mainview/stores/use-theme-store.ts +46 -0
- package/templates/cowork/src/mainview/stores/use-view-store.ts +29 -0
- package/templates/cowork/src/mainview/types/index.ts +6 -0
- package/templates/cowork/src/server-config.ts +44 -0
- package/templates/cowork/src/server.ts +78 -0
- package/templates/cowork/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
- package/templates/cowork/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
- package/templates/cowork/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
- package/templates/cowork/src/shared/handlers/__tests__/preview-handler.test.ts +172 -0
- package/templates/cowork/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
- package/templates/cowork/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
- package/templates/cowork/src/shared/handlers/chat.ts +213 -0
- package/templates/cowork/src/shared/handlers/context.ts +72 -0
- package/templates/cowork/src/shared/handlers/file.ts +99 -0
- package/templates/cowork/src/shared/handlers/index.ts +9 -0
- package/templates/cowork/src/shared/handlers/output.ts +59 -0
- package/templates/cowork/src/shared/handlers/preview.ts +81 -0
- package/templates/cowork/src/shared/handlers/system.ts +27 -0
- package/templates/cowork/src/shared/handlers/task.ts +101 -0
- package/templates/cowork/src/shared/handlers/timer.ts +34 -0
- package/templates/cowork/src/shared/http-routes.ts +444 -0
- package/templates/cowork/src/shared/lib/__tests__/logger.test.ts +92 -0
- package/templates/cowork/src/shared/lib/__tests__/path-security.test.ts +77 -0
- package/templates/cowork/src/shared/lib/__tests__/web-server.test.ts +203 -0
- package/templates/cowork/src/shared/lib/logger.ts +152 -0
- package/templates/cowork/src/shared/lib/path-security.ts +38 -0
- package/templates/cowork/src/shared/lib/port-registry.ts +103 -0
- package/templates/cowork/src/shared/lib/web-server.ts +127 -0
- package/templates/cowork/src/shared/modules/chat.ts +20 -0
- package/templates/cowork/src/shared/modules/context.ts +32 -0
- package/templates/cowork/src/shared/modules/file.ts +40 -0
- package/templates/cowork/src/shared/modules/output.ts +20 -0
- package/templates/cowork/src/shared/modules/preview.ts +44 -0
- package/templates/cowork/src/shared/modules/system.ts +8 -0
- package/templates/cowork/src/shared/modules/task.ts +31 -0
- package/templates/cowork/src/shared/modules/timer.ts +11 -0
- package/templates/cowork/src/shared/register-all-handlers.ts +36 -0
- package/templates/cowork/src/shared/rpc-schema.ts +38 -0
- package/templates/cowork/tailwind.config.js +15 -0
- package/templates/cowork/test-upload.txt +0 -0
- package/templates/cowork/tsconfig.ipc.json +14 -0
- package/templates/cowork/tsconfig.json +36 -0
- package/templates/cowork/vite.config.ts +3 -0
- package/templates/cowork/vitest.config.ts +3 -0
- package/templates/general/.husky/commit-msg +4 -0
- package/templates/general/.husky/pre-commit +11 -0
- package/templates/general/.husky/pre-push +6 -0
- package/templates/general/CHANGELOG.md +15 -0
- package/templates/general/commitlint.config.js +8 -0
- package/templates/general/package.json +19 -4
- package/templates/general/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
- package/templates/general/src/mainview/__tests__/setup.ts +32 -29
- package/templates/general/src/mainview/components/chat/ChatPanel.tsx +80 -55
- package/templates/general/src/mainview/components/common/ThemeToggle.tsx +40 -20
- package/templates/general/src/mainview/components/debug/DebugPanel.tsx +170 -156
- package/templates/general/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +169 -0
- package/templates/general/src/mainview/components/explorer/ConfirmDialog.tsx +42 -42
- package/templates/general/src/mainview/components/explorer/ContextMenu.tsx +72 -67
- package/templates/general/src/mainview/components/feed/FeedPanel.tsx +7 -5
- package/templates/general/src/mainview/components/file-preview/FilePreviewOverlay.tsx +64 -45
- package/templates/general/src/mainview/components/file-preview/VirtualizedCodeView.tsx +24 -7
- package/templates/general/src/mainview/components/git/GitPanel.tsx +700 -473
- package/templates/general/src/mainview/components/layout/AppLayout.tsx +123 -114
- package/templates/general/src/mainview/components/search/SearchPanel.tsx +15 -19
- package/templates/general/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/general/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/general/src/mainview/stores/__tests__/use-explorer-store.test.ts +259 -0
- package/templates/general/src/mainview/stores/__tests__/use-feed-store.test.ts +160 -0
- package/templates/general/src/mainview/stores/__tests__/use-git-store.test.ts +313 -0
- package/templates/general/src/mainview/stores/__tests__/use-notification-store.test.ts +115 -0
- package/templates/general/src/mainview/stores/__tests__/use-sidebar-store.test.ts +120 -0
- package/templates/general/src/mainview/stores/use-explorer-store.ts +277 -260
- package/templates/general/src/mainview/types/index.ts +21 -20
- package/templates/general/src/shared/handlers/chat.ts +1 -1
- package/templates/general/src/shared/handlers/debug.ts +12 -2
- package/templates/shared/components/ErrorBoundary.tsx +0 -1
- package/templates/shared/vite-base.config.ts +8 -7
- /package/templates/{shared → browser-agent}/test-upload.txt +0 -0
|
@@ -1,163 +1,171 @@
|
|
|
1
|
-
import { describe, it, expect, vi, afterEach } from
|
|
2
|
-
import { render, screen, cleanup, fireEvent } from
|
|
3
|
-
import React from
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
|
+
import { render, screen, cleanup, fireEvent } from '@testing-library/react';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
|
|
5
|
-
vi.mock(
|
|
6
|
-
|
|
5
|
+
vi.mock('../../../stores/use-connection-store', () => ({
|
|
6
|
+
useConnectionStore: <T,>(selector: (s: Record<string, unknown>) => T) =>
|
|
7
|
+
selector({ mode: 'desktop' }),
|
|
7
8
|
}));
|
|
8
9
|
|
|
9
|
-
vi.mock(
|
|
10
|
-
|
|
10
|
+
vi.mock('../../../stores/use-explorer-store', () => ({
|
|
11
|
+
useExplorerStore: <T,>(selector: (s: Record<string, unknown>) => T) =>
|
|
12
|
+
selector({ filePreview: null, loadingFile: false, closePreview: vi.fn() }),
|
|
11
13
|
}));
|
|
12
14
|
|
|
13
|
-
vi.mock(
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
vi.mock('../../../stores/use-sidebar-store', () => ({
|
|
16
|
+
useSidebarStore: <T,>(selector: (s: Record<string, unknown>) => T) =>
|
|
17
|
+
selector({
|
|
18
|
+
activePanel: 'explorer',
|
|
19
|
+
isPinned: true,
|
|
20
|
+
drawerOpen: false,
|
|
21
|
+
breakpoint: 'desktop',
|
|
22
|
+
setDrawerOpen: vi.fn(),
|
|
23
|
+
}),
|
|
16
24
|
}));
|
|
17
25
|
|
|
18
|
-
vi.mock(
|
|
19
|
-
|
|
26
|
+
vi.mock('../../activity-bar/ActivityBar', () => ({
|
|
27
|
+
ActivityBar: () => <div data-testid="activity-bar" />,
|
|
20
28
|
}));
|
|
21
29
|
|
|
22
|
-
vi.mock(
|
|
23
|
-
|
|
30
|
+
vi.mock('../../activity-bar/MobileTabBar', () => ({
|
|
31
|
+
MobileTabBar: () => <div data-testid="mobile-tab-bar" />,
|
|
24
32
|
}));
|
|
25
33
|
|
|
26
|
-
vi.mock(
|
|
27
|
-
|
|
34
|
+
vi.mock('../../explorer/ExplorerSidebar', () => ({
|
|
35
|
+
ExplorerSidebar: () => <div data-testid="explorer-sidebar" />,
|
|
28
36
|
}));
|
|
29
37
|
|
|
30
|
-
vi.mock(
|
|
31
|
-
|
|
38
|
+
vi.mock('../../git/GitPanel', () => ({
|
|
39
|
+
GitPanel: () => <div data-testid="git-panel" />,
|
|
32
40
|
}));
|
|
33
41
|
|
|
34
|
-
vi.mock(
|
|
35
|
-
|
|
42
|
+
vi.mock('../../search/SearchPanel', () => ({
|
|
43
|
+
SearchPanel: () => <div data-testid="search-panel" />,
|
|
36
44
|
}));
|
|
37
45
|
|
|
38
|
-
vi.mock(
|
|
39
|
-
|
|
46
|
+
vi.mock('../../rules/RulesPanel', () => ({
|
|
47
|
+
RulesPanel: () => <div data-testid="rules-panel" />,
|
|
40
48
|
}));
|
|
41
49
|
|
|
42
|
-
vi.mock(
|
|
43
|
-
|
|
50
|
+
vi.mock('../../chat/ChatPanel', () => ({
|
|
51
|
+
ChatPanel: () => <div data-testid="chat-panel" />,
|
|
44
52
|
}));
|
|
45
53
|
|
|
46
|
-
vi.mock(
|
|
47
|
-
|
|
54
|
+
vi.mock('../../feed/FeedPanel', () => ({
|
|
55
|
+
FeedPanel: () => <div data-testid="feed-panel" />,
|
|
48
56
|
}));
|
|
49
57
|
|
|
50
|
-
vi.mock(
|
|
51
|
-
|
|
58
|
+
vi.mock('../../bash/BashPanel', () => ({
|
|
59
|
+
BashPanel: () => <div data-testid="bash-panel" />,
|
|
52
60
|
}));
|
|
53
61
|
|
|
54
|
-
vi.mock(
|
|
55
|
-
|
|
62
|
+
vi.mock('../../todo/TodoPanel', () => ({
|
|
63
|
+
TodoPanel: () => <div data-testid="todo-panel" />,
|
|
56
64
|
}));
|
|
57
65
|
|
|
58
|
-
vi.mock(
|
|
59
|
-
|
|
66
|
+
vi.mock('../../file-preview/FilePreviewOverlay', () => ({
|
|
67
|
+
FilePreviewOverlay: () => <div data-testid="file-preview" />,
|
|
60
68
|
}));
|
|
61
69
|
|
|
62
|
-
vi.mock(
|
|
63
|
-
|
|
70
|
+
vi.mock('../../diff/DiffViewerPanel', () => ({
|
|
71
|
+
DiffViewerPanel: () => <div data-testid="diff-panel" />,
|
|
64
72
|
}));
|
|
65
73
|
|
|
66
|
-
vi.mock(
|
|
67
|
-
|
|
74
|
+
vi.mock('../../debug/DebugPanel', () => ({
|
|
75
|
+
DebugPanel: () => <div data-testid="debug-panel" />,
|
|
68
76
|
}));
|
|
69
77
|
|
|
70
|
-
vi.mock(
|
|
71
|
-
|
|
78
|
+
vi.mock('../../common/ThemeToggle', () => ({
|
|
79
|
+
ThemeToggle: () => <div data-testid="theme-toggle" />,
|
|
72
80
|
}));
|
|
73
81
|
|
|
74
|
-
vi.mock(
|
|
75
|
-
|
|
82
|
+
vi.mock('react-i18next', () => ({
|
|
83
|
+
useTranslation: () => ({ t: (k: string) => k }),
|
|
76
84
|
}));
|
|
77
85
|
|
|
78
|
-
describe(
|
|
79
|
-
|
|
86
|
+
describe('AppLayout', () => {
|
|
87
|
+
afterEach(cleanup);
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
it('should render center tab buttons', async () => {
|
|
90
|
+
const { AppLayout } = await import('../AppLayout');
|
|
91
|
+
render(
|
|
92
|
+
<AppLayout
|
|
93
|
+
centerTab="chat"
|
|
94
|
+
setCenterTab={vi.fn()}
|
|
95
|
+
sidebarWidth={240}
|
|
96
|
+
handleResizeStart={vi.fn()}
|
|
97
|
+
/>,
|
|
98
|
+
);
|
|
99
|
+
expect(screen.getByText('tabs.chat')).toBeDefined();
|
|
100
|
+
expect(screen.getByText('tabs.feed')).toBeDefined();
|
|
101
|
+
expect(screen.getByText('tabs.bash')).toBeDefined();
|
|
102
|
+
expect(screen.getByText('tabs.todo')).toBeDefined();
|
|
103
|
+
});
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
it('should render ActivityBar on desktop', async () => {
|
|
106
|
+
const { AppLayout } = await import('../AppLayout');
|
|
107
|
+
render(
|
|
108
|
+
<AppLayout
|
|
109
|
+
centerTab="chat"
|
|
110
|
+
setCenterTab={vi.fn()}
|
|
111
|
+
sidebarWidth={240}
|
|
112
|
+
handleResizeStart={vi.fn()}
|
|
113
|
+
/>,
|
|
114
|
+
);
|
|
115
|
+
expect(screen.getByTestId('activity-bar')).toBeDefined();
|
|
116
|
+
});
|
|
109
117
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
118
|
+
it('should render sidebar content when panel is active and pinned', async () => {
|
|
119
|
+
const { AppLayout } = await import('../AppLayout');
|
|
120
|
+
render(
|
|
121
|
+
<AppLayout
|
|
122
|
+
centerTab="chat"
|
|
123
|
+
setCenterTab={vi.fn()}
|
|
124
|
+
sidebarWidth={240}
|
|
125
|
+
handleResizeStart={vi.fn()}
|
|
126
|
+
/>,
|
|
127
|
+
);
|
|
128
|
+
expect(screen.getByTestId('explorer-sidebar')).toBeDefined();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should call setCenterTab when tab is clicked', async () => {
|
|
132
|
+
const setCenterTab = vi.fn();
|
|
133
|
+
const { AppLayout } = await import('../AppLayout');
|
|
134
|
+
render(
|
|
135
|
+
<AppLayout
|
|
136
|
+
centerTab="chat"
|
|
137
|
+
setCenterTab={setCenterTab}
|
|
138
|
+
sidebarWidth={240}
|
|
139
|
+
handleResizeStart={vi.fn()}
|
|
140
|
+
/>,
|
|
141
|
+
);
|
|
142
|
+
fireEvent.click(screen.getByText('tabs.feed'));
|
|
143
|
+
expect(setCenterTab).toHaveBeenCalledWith('feed');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should render mode indicator in title bar', async () => {
|
|
147
|
+
const { AppLayout } = await import('../AppLayout');
|
|
148
|
+
render(
|
|
149
|
+
<AppLayout
|
|
150
|
+
centerTab="chat"
|
|
151
|
+
setCenterTab={vi.fn()}
|
|
152
|
+
sidebarWidth={240}
|
|
153
|
+
handleResizeStart={vi.fn()}
|
|
154
|
+
/>,
|
|
155
|
+
);
|
|
156
|
+
expect(screen.getByText('app.mode.desktop')).toBeDefined();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should render DebugPanel on desktop', async () => {
|
|
160
|
+
const { AppLayout } = await import('../AppLayout');
|
|
161
|
+
render(
|
|
162
|
+
<AppLayout
|
|
163
|
+
centerTab="chat"
|
|
164
|
+
setCenterTab={vi.fn()}
|
|
165
|
+
sidebarWidth={240}
|
|
166
|
+
handleResizeStart={vi.fn()}
|
|
167
|
+
/>,
|
|
168
|
+
);
|
|
169
|
+
expect(screen.getByTestId('debug-panel')).toBeDefined();
|
|
170
|
+
});
|
|
163
171
|
});
|
|
@@ -1,117 +1,127 @@
|
|
|
1
|
-
import { useState, useEffect } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import { Plus, Trash2, Shield, CheckCircle2, Circle } from
|
|
4
|
-
import { useRulesStore } from
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Plus, Trash2, Shield, CheckCircle2, Circle } from 'lucide-react';
|
|
4
|
+
import { useRulesStore } from '../../stores/use-rules-store';
|
|
5
5
|
|
|
6
6
|
export function RulesPanel() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const [showForm, setShowForm] = useState(false);
|
|
9
|
+
const [name, setName] = useState('');
|
|
10
|
+
const [pattern, setPattern] = useState('');
|
|
11
|
+
const rules = useRulesStore((s) => s.rules);
|
|
12
|
+
const fetchRules = useRulesStore((s) => s.fetchRules);
|
|
13
|
+
const addRule = useRulesStore((s) => s.addRule);
|
|
14
|
+
const toggleRule = useRulesStore((s) => s.toggleRule);
|
|
15
|
+
const removeRule = useRulesStore((s) => s.removeRule);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
fetchRules();
|
|
19
|
+
}, [fetchRules]);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const handleAdd = () => {
|
|
22
|
+
if (!name.trim() || !pattern.trim()) return;
|
|
23
|
+
addRule(name.trim(), pattern.trim());
|
|
24
|
+
setName('');
|
|
25
|
+
setPattern('');
|
|
26
|
+
setShowForm(false);
|
|
27
|
+
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
return (
|
|
30
|
+
<div className="flex flex-col h-full">
|
|
31
|
+
<div className="p-3 border-b border-[var(--color-border-primary)] flex items-center justify-between">
|
|
32
|
+
<div className="flex items-center gap-2 text-sm text-[var(--color-text-secondary)]">
|
|
33
|
+
<Shield className="w-4 h-4" />
|
|
34
|
+
{t('rules.title')}
|
|
35
|
+
</div>
|
|
36
|
+
<button
|
|
37
|
+
onClick={() => setShowForm(!showForm)}
|
|
38
|
+
className="flex items-center gap-1 px-2 py-1 text-xs bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] rounded text-[var(--color-text-primary)]"
|
|
39
|
+
>
|
|
40
|
+
<Plus className="w-3 h-3" />
|
|
41
|
+
{t('rules.add')}
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
{showForm && (
|
|
46
|
+
<div className="p-3 border-b border-[var(--color-border-primary)] bg-[var(--color-bg-secondary)] flex flex-col gap-2">
|
|
47
|
+
<input
|
|
48
|
+
type="text"
|
|
49
|
+
value={name}
|
|
50
|
+
onChange={(e) => setName(e.target.value)}
|
|
51
|
+
placeholder={t('rules.namePlaceholder')}
|
|
52
|
+
className="bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] px-3 py-1.5 rounded text-sm border border-[var(--color-border-secondary)] focus:border-[var(--color-accent)] focus:outline-none"
|
|
53
|
+
/>
|
|
54
|
+
<input
|
|
55
|
+
type="text"
|
|
56
|
+
value={pattern}
|
|
57
|
+
onChange={(e) => setPattern(e.target.value)}
|
|
58
|
+
placeholder={t('rules.patternPlaceholder')}
|
|
59
|
+
className="bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] px-3 py-1.5 rounded text-sm font-mono border border-[var(--color-border-secondary)] focus:border-[var(--color-accent)] focus:outline-none"
|
|
60
|
+
/>
|
|
61
|
+
<button
|
|
62
|
+
onClick={handleAdd}
|
|
63
|
+
disabled={!name.trim() || !pattern.trim()}
|
|
64
|
+
className="self-end px-3 py-1 text-xs bg-[var(--color-text-success)] hover:opacity-80 disabled:opacity-40 rounded text-white"
|
|
65
|
+
>
|
|
66
|
+
{t('rules.save')}
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
71
|
+
<div className="flex-1 overflow-auto p-3">
|
|
72
|
+
{rules.length === 0 ? (
|
|
73
|
+
<div className="flex flex-col items-center justify-center h-full text-[var(--color-text-tertiary)]">
|
|
74
|
+
<Shield className="w-12 h-12 mb-3 opacity-30" />
|
|
75
|
+
<span className="text-sm">{t('rules.empty')}</span>
|
|
76
|
+
<span className="text-xs mt-1">{t('rules.emptyHint')}</span>
|
|
77
|
+
</div>
|
|
78
|
+
) : (
|
|
79
|
+
<div className="space-y-2.5">
|
|
80
|
+
{rules.map((rule) => (
|
|
81
|
+
<div
|
|
82
|
+
key={rule.id}
|
|
83
|
+
onClick={() => toggleRule(rule.id)}
|
|
84
|
+
className="group relative bg-[var(--color-bg-secondary)]/60 border border-[var(--color-border-primary)]/80 rounded-lg p-3 cursor-pointer hover:bg-[var(--color-bg-secondary)] hover:border-[var(--color-border-secondary)] transition-all"
|
|
85
|
+
>
|
|
86
|
+
<div className="flex items-start justify-between gap-2">
|
|
87
|
+
<div className="flex items-center gap-2 min-w-0 flex-1">
|
|
88
|
+
{rule.enabled ? (
|
|
89
|
+
<CheckCircle2 className="w-4 h-4 text-[var(--color-text-success)] flex-shrink-0 mt-0.5" />
|
|
90
|
+
) : (
|
|
91
|
+
<Circle className="w-4 h-4 text-[var(--color-text-placeholder)] flex-shrink-0 mt-0.5" />
|
|
92
|
+
)}
|
|
93
|
+
<span
|
|
94
|
+
className={`font-semibold text-sm truncate ${rule.enabled ? 'text-[var(--color-text-secondary)]' : 'text-[var(--color-text-placeholder)]'}`}
|
|
95
|
+
>
|
|
96
|
+
{rule.name}
|
|
97
|
+
</span>
|
|
98
|
+
</div>
|
|
99
|
+
<code className="text-[11px] font-mono text-[var(--color-text-placeholder)] bg-[var(--color-bg-primary)]/80 px-1.5 py-0.5 rounded flex-shrink-0 hidden sm:block">
|
|
100
|
+
{rule.pattern}
|
|
101
|
+
</code>
|
|
102
|
+
<button
|
|
103
|
+
onClick={(e) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
removeRule(rule.id);
|
|
106
|
+
}}
|
|
107
|
+
className="text-[var(--color-text-tertiary)] hover:text-[var(--color-text-error)] opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"
|
|
108
|
+
>
|
|
109
|
+
<Trash2 className="w-3.5 h-3.5" />
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
<p
|
|
113
|
+
className={`text-xs mt-1.5 ml-6 ${rule.enabled ? 'text-[var(--color-text-tertiary)]' : 'text-[var(--color-text-tertiary)]'}`}
|
|
114
|
+
>
|
|
115
|
+
{t('rules.pattern')}{' '}
|
|
116
|
+
<code className="font-mono text-[var(--color-text-placeholder)]">
|
|
117
|
+
{rule.pattern}
|
|
118
|
+
</code>
|
|
119
|
+
</p>
|
|
120
|
+
</div>
|
|
121
|
+
))}
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
117
127
|
}
|