fix: 修复文件层级重构后的架构问题

- 恢复 IPC 类型声明 (src/electron-api.d.ts),修复 31 个 TS2339 错误
- 修复构建断裂:vite.config.ts 改回 electron.vite.config.ts
- 修复 2 个 verbatimModuleSyntax type-import 报错
- 修正 .gitignore 构建产物路径 (electron-dist/ -> dist-electron/ + release/)
- 清理 55+ 处过时路径注释
- 更新 AGENTS.md 架构文档与 IPC 通道表
- 修正 docs/ROADMAP.md 过时引用
This commit is contained in:
2026-07-10 23:22:53 +08:00
parent fe7801062f
commit 157af4399f
62 changed files with 222 additions and 102 deletions
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/App.vue
import { ref, onMounted } from 'vue'
import TitleBar from './components/TitleBar.vue'
import Sidebar from './components/Sidebar.vue'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/renderer/src/components/CliView.vue
import { ref, computed, nextTick, watch, onMounted, onUnmounted } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/CommandLog.vue
import { ref, onMounted } from 'vue'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/renderer/src/components/ConnectionCard.vue
import { computed, ref } from 'vue'
import { ElMessage } from 'element-plus'
import type { ConnectionConfig } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/ConnectionList.vue
import { ref, computed } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import ConnectionCard from './ConnectionCard.vue'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/DbSelector.vue
import { ref, watch, computed } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useKeyStore } from '@renderer/stores/key'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/HashEditor.vue
import { ref, watch, computed, onMounted } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/renderer/src/components/KeyBrowser.vue
import { watch } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/KeyDetail.vue
import { computed, ref } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/KeyList.vue
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
import { useVirtualizer } from '@tanstack/vue-virtual'
import { useKeyStore } from '@renderer/stores/key'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/ListEditor.vue
import { ref, watch } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/MainArea.vue
import { ref, watch, computed, nextTick, onMounted, onUnmounted } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/MemoryAnalysis.vue
import { ref, computed, onUnmounted } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/NewConnectionDialog.vue
import { reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/ReJsonEditor.vue
import { ref, watch, computed } from 'vue'
import { VueMonacoEditor } from '@guolao/vue-monaco-editor'
import { useKeyStore } from '@renderer/stores/key'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/SetEditor.vue
import { ref, watch } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/renderer/src/components/SettingsView.vue
import { useAppStore } from '@renderer/stores/app'
import { useI18n } from '@renderer/i18n'
import { ref } from 'vue'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/Sidebar.vue
import { ref, onMounted, onUnmounted } from 'vue'
import ConnectionList from './ConnectionList.vue'
import NewConnectionDialog from './NewConnectionDialog.vue'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/SlowLogView.vue
import { ref, computed, onMounted } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/StatusBar.vue
import { computed } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/StatusView.vue
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
import { useConnectionStore } from '@renderer/stores/connection'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/StreamEditor.vue
import { ref, watch } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/StringEditor.vue
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
import { VueMonacoEditor } from '@guolao/vue-monaco-editor'
import { useKeyStore } from '@renderer/stores/key'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/TitleBar.vue
import { useAppStore } from '@renderer/stores/app'
import { useI18n } from '@renderer/i18n'
-1
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
// src/components/ZsetEditor.vue
import { ref, watch } from 'vue'
import { useKeyStore } from '@renderer/stores/key'
import { useConnectionStore } from '@renderer/stores/connection'
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/composables/useKeyboard.ts
import { onMounted, onUnmounted } from 'vue'
interface ShortcutMap {
+144
View File
@@ -0,0 +1,144 @@
/// <reference types="vite/client" />
/**
* Electron preload bridge type declarations.
*
* Mirrors the API exposed via contextBridge in `electron/preload.ts`.
* Keeps the renderer fully typed at the IPC boundary without any Node access.
*/
export interface ElectronAPI {
window: {
minimize: () => void
maximize: () => void
close: () => void
}
theme: {
get: () => Promise<boolean>
set: (theme: 'system' | 'dark' | 'light') => void
onOsUpdated: (callback: (isDark: boolean) => void) => void
}
dialog: {
openFile: (options: {
title?: string
filters?: { name: string; extensions: string[] }[]
}) => Promise<any>
}
credential: {
encrypt: (text: string) => Promise<string>
decrypt: (encoded: string) => Promise<string>
}
storage: {
getConnections: () => Promise<any[]>
saveConnection: (conn: any) => Promise<any[]>
deleteConnection: (id: string) => Promise<any[]>
reorderConnections: (ids: string[]) => Promise<any[]>
getSettings: () => Promise<any>
saveSettings: (settings: any) => Promise<void>
}
redis: {
// Connection
connect: (id: string, opts: any) => Promise<any>
disconnect: (id: string) => Promise<void>
execute: (id: string, command: string, args: string[]) => Promise<any>
getInfo: (id: string) => Promise<string>
ping: (id: string) => Promise<string>
isConnected: (id: string) => Promise<boolean>
selectDb: (id: string, db: number) => Promise<void>
dbSize: (id: string) => Promise<number>
// Key operations
scanKeys: (id: string, cursor: string, pattern: string, count: number) => Promise<any>
getKeyType: (id: string, key: string) => Promise<string>
getKeyTTL: (id: string, key: string) => Promise<number>
deleteKey: (id: string, key: string) => Promise<void>
renameKey: (id: string, oldKey: string, newKey: string) => Promise<void>
existsKey: (id: string, key: string) => Promise<boolean>
setTTL: (id: string, key: string, ttl: number) => Promise<void>
batchDelete: (id: string, keys: string[]) => Promise<number>
memoryUsage: (id: string, key: string) => Promise<number | null>
// String
getString: (id: string, key: string) => Promise<string | null>
setString: (id: string, key: string, value: string) => Promise<void>
// Hash
hashScan: (id: string, key: string, cursor: string, count: number) => Promise<any>
hashSet: (id: string, key: string, field: string, value: string) => Promise<void>
hashDel: (id: string, key: string, field: string) => Promise<void>
// List
listRange: (id: string, key: string, start: number, stop: number) => Promise<string[]>
listLength: (id: string, key: string) => Promise<number>
listPush: (id: string, key: string, values: string[]) => Promise<number>
listSet: (id: string, key: string, index: number, value: string) => Promise<void>
listRemove: (id: string, key: string, count: number, value: string) => Promise<number>
// Set
setMembers: (id: string, key: string) => Promise<string[]>
setSize: (id: string, key: string) => Promise<number>
setAdd: (id: string, key: string, members: string[]) => Promise<number>
setRemove: (id: string, key: string, members: string[]) => Promise<number>
// Sorted set
zsetRange: (
id: string,
key: string,
start: number,
stop: number,
withScores: boolean,
) => Promise<string[]>
zsetSize: (id: string, key: string) => Promise<number>
zsetAdd: (id: string, key: string, score: number, member: string) => Promise<number>
zsetRemove: (id: string, key: string, members: string[]) => Promise<number>
// Stream
streamInfo: (id: string, key: string) => Promise<any>
streamRange: (
id: string,
key: string,
start: string,
end: string,
count: number,
) => Promise<any[]>
streamAdd: (id: string, key: string, streamId: string, fieldValues: string[]) => Promise<string>
streamTrim: (id: string, key: string, maxLen: number) => Promise<number>
streamDel: (id: string, key: string, ids: string[]) => Promise<number>
streamGroups: (id: string, key: string) => Promise<any[]>
streamConsumers: (id: string, key: string, group: string) => Promise<any[]>
streamGroupCreate: (
id: string,
key: string,
group: string,
startId: string,
mkstream: boolean,
) => Promise<any>
streamGroupDestroy: (id: string, key: string, group: string) => Promise<number>
streamAck: (id: string, key: string, group: string, ids: string[]) => Promise<number>
// ReJson
rejsonGet: (id: string, key: string, path: string) => Promise<string>
rejsonSet: (id: string, key: string, path: string, value: string) => Promise<void>
// Slow log
slowLogGet: (id: string, count: number) => Promise<any[]>
slowLogLen: (id: string) => Promise<number>
// Command log
getCommandLog: () => Promise<any[]>
clearCommandLog: () => Promise<void>
// Format
decodeValue: (value: string, format: string) => Promise<string>
detectFormat: (value: string) => Promise<string>
customFormat: (value: string, command: string, key: string) => Promise<string>
// Pub/Sub
subscribe: (id: string, channels: string[], isPattern: boolean) => Promise<any>
unsubscribe: (id: string) => Promise<void>
onSubscribeMessage: (callback: (msg: any) => void) => void
// Monitor
monitor: (id: string) => Promise<any>
monitorStop: (id: string) => Promise<void>
onMonitorMessage: (callback: (msg: any) => void) => void
}
updater: {
check: () => Promise<any>
download: () => Promise<any>
install: () => Promise<any>
onStatus: (callback: (status: any) => void) => void
}
}
declare global {
interface Window {
electronAPI: ElectronAPI
}
}
-1
View File
@@ -1,4 +1,3 @@
// src/i18n/index.ts
import { ref, computed, watch } from 'vue'
import en from './locales/en'
import zhCN from './locales/zh-CN'
-1
View File
@@ -1,4 +1,3 @@
// src/i18n/locales/de.ts
export default {
common: {
ok: 'OK',
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/i18n/locales/en.ts
export default {
common: {
ok: 'OK',
-1
View File
@@ -1,4 +1,3 @@
// src/i18n/locales/ja.ts
export default {
common: {
ok: 'OK',
-1
View File
@@ -1,4 +1,3 @@
// src/i18n/locales/ko.ts
export default {
common: {
ok: '확인',
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/i18n/locales/zh-CN.ts
export default {
common: {
ok: '确定',
-1
View File
@@ -1,4 +1,3 @@
// src/main.ts
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/stores/app.ts
import { defineStore } from 'pinia'
import { ref } from 'vue'
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/stores/connection.ts
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
-1
View File
@@ -1,4 +1,3 @@
// src/renderer/src/stores/key.ts
import { defineStore } from 'pinia'
import { ref } from 'vue'
-1
View File
@@ -1,4 +1,3 @@
// src/utils/binary.ts
export function isBinaryKey(key: string): boolean {
// Check for non-printable characters (outside 0x20-0x7E, not standard whitespace)
for (let i = 0; i < key.length; i++) {