/** * scripts/extract-kb-workspace-composable.mjs * 将 KbWorkspaceView.vue 的 script 提取为 useKbWorkspace.ts 骨架。 */ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const vuePath = path.resolve(__dirname, '../src/features/kb/views/KbWorkspaceView.vue'); const outPath = path.resolve(__dirname, '../src/features/kb/composables/useKbWorkspace.ts'); const vue = fs.readFileSync(vuePath, 'utf8'); const scriptMatch = vue.match(/