cardbuddy 0.9.1 → 0.11.0
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/README.md +21 -6
- package/dist/cli.js +17 -6
- package/dist/config.js +20 -2
- package/dist/portGuard.js +293 -0
- package/dist/preview-editor/assets/index-B4VZgNSK.css +1 -0
- package/dist/preview-editor/assets/index-jl4YJzKv.js +180 -0
- package/dist/preview-editor/index.html +2 -2
- package/dist/server-core/_vendor/finmall-env.mjs +4 -4
- package/dist/server-core/ai-chat.js +3710 -0
- package/dist/server-core/assetProxy.js +3 -22
- package/dist/server-core/buildDataFromSchema.js +36 -4
- package/dist/server-core/cardFiles.js +95 -2
- package/dist/server-core/cardImage.js +14 -0
- package/dist/server-core/cardListCache.js +0 -17
- package/dist/server-core/cardSave.js +2 -0
- package/dist/server-core/cardValidate.js +3 -0
- package/dist/server-core/index.js +6 -5
- package/dist/server-core/logStream.js +1 -6
- package/dist/server-core/sliceUpload.js +8 -1
- package/dist/standalone.js +24 -8
- package/dist/vendored/App.vue +405 -125
- package/dist/vendored/api.js +4 -4
- package/dist/vendored/assets/svgIcons/icons.svg +28 -0
- package/dist/vendored/components/AiSettings.vue +392 -0
- package/dist/vendored/components/CardGallery.vue +51 -5
- package/dist/vendored/components/ChatComposer.vue +413 -0
- package/dist/vendored/components/ChatMessage.vue +383 -0
- package/dist/vendored/components/ChatPanel.vue +937 -0
- package/dist/vendored/components/ComponentPalette.vue +1 -1
- package/dist/vendored/components/DebugPanel.vue +732 -90
- package/dist/vendored/components/Dropdown.vue +4 -2
- package/dist/vendored/components/MarkdownBody.vue +64 -0
- package/dist/vendored/components/NewCardDialog.vue +132 -0
- package/dist/vendored/components/NumberStepper.vue +125 -0
- package/dist/vendored/components/ProgressSlider.vue +9 -1
- package/dist/vendored/components/RemotePreview.vue +1 -1
- package/dist/vendored/components/StructureTree.vue +2 -2
- package/dist/vendored/main.js +1 -0
- package/dist/vendored/runtime/adapter.js +1 -1
- package/dist/vendored/runtime/ai-api.js +165 -0
- package/dist/vendored/runtime/clipboard-node.js +0 -5
- package/dist/vendored/runtime/markdown.js +140 -0
- package/dist/vendored/skills/.manifest.json +1101 -0
- package/dist/vendored/skills/dsl-card-generator/scripts/autofix_schema.py +249 -0
- package/dist/vendored/skills/dsl-card-generator/scripts/check_topology.py +678 -0
- package/dist/vendored/skills/dsl-card-generator/scripts/derive_data_json.py +81 -0
- package/dist/vendored/skills/dsl-card-generator/scripts/lib/paths.py +105 -0
- package/dist/vendored/skills/dsl-card-generator/scripts/validate_schema.py +624 -0
- package/dist/vendored/skills/finmall-card-sync/scripts/api_batch_sync.mjs +900 -0
- package/dist/vendored/skills/finmall-card-sync/scripts/slice_upload.mjs +699 -0
- package/dist/vendored/skills/shared/finmall-config.mjs +124 -0
- package/dist/vendored/styles/ai-chat.css +1850 -0
- package/dist/vendored/styles/app.css +725 -213
- package/dist/vendored/styles/card-gallery.css +48 -10
- package/dist/vendored/styles/card-select.css +13 -6
- package/dist/vendored/styles/dropdown.css +1 -2
- package/dist/vendored/styles/json-tree.css +3 -3
- package/dist/vendored/styles/node-inspector.css +13 -289
- package/dist/vendored/styles/setters.css +48 -49
- package/dist/vendored/styles/structure-tree.css +6 -11
- package/package.json +1 -1
- package/dist/preview-editor/assets/index-B9MOriNv.js +0 -80
- package/dist/preview-editor/assets/index-CwD14gm3.css +0 -1
- package/dist/vendored/assets/logo.png +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FinMall 环境配置加载器。优先级:process.env > .env.cb.local > .env.cb > 内置默认值。
|
|
3
|
+
* 导出 finmallConfig{baseUrl,appId,workspaceId,cdpPort,targetUrl,loginEndpoint,menuEndpoint,
|
|
4
|
+
* uploadImgEndpoint,filestoreUrl(path)},供 skills 脚本统一读取环境地址,不硬编码。
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync, existsSync } from 'node:fs'
|
|
7
|
+
import path from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 从给定起点向上查找仓库根(含 package.json 的目录)。
|
|
14
|
+
* 与 dsl-card-generator/scripts/lib/paths.mjs 同思路:
|
|
15
|
+
* 不依赖相对层级魔法数字(`'..', '..', '..'`),按 package.json 锚点定位。
|
|
16
|
+
* 这样无论 shared/ 目录被移动到 skills/shared/ 还是 .workbuddy/skills/shared/,
|
|
17
|
+
* 只要还在仓库内就能正确解析。
|
|
18
|
+
*/
|
|
19
|
+
function findRepoRoot(startDir) {
|
|
20
|
+
let dir = path.resolve(startDir)
|
|
21
|
+
for (let i = 0; i < 10; i++) {
|
|
22
|
+
if (existsSync(path.join(dir, 'package.json'))) return dir
|
|
23
|
+
const parent = path.dirname(dir)
|
|
24
|
+
if (parent === dir) break // 已到根
|
|
25
|
+
dir = parent
|
|
26
|
+
}
|
|
27
|
+
// 极端 fallback:旧式三层上跳(shared/ → skills/ → <repo>/)
|
|
28
|
+
// 仅当 package.json 不存在时使用(如 monorepo 子包场景)
|
|
29
|
+
return path.resolve(__dirname, '..', '..')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const PROJECT_ROOT = findRepoRoot(__dirname)
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 解析 .env 文件,返回 key-value 对象。
|
|
36
|
+
* 支持 # 注释、空行、引号包裹的值。
|
|
37
|
+
*/
|
|
38
|
+
function parseEnvFile(filePath) {
|
|
39
|
+
const result = {}
|
|
40
|
+
if (!existsSync(filePath)) return result
|
|
41
|
+
const content = readFileSync(filePath, 'utf-8')
|
|
42
|
+
for (const raw of content.split(/\r?\n/)) {
|
|
43
|
+
const line = raw.trim()
|
|
44
|
+
if (!line || line.startsWith('#')) continue
|
|
45
|
+
const eq = line.indexOf('=')
|
|
46
|
+
if (eq < 0) continue
|
|
47
|
+
const key = line.slice(0, eq).trim()
|
|
48
|
+
let val = line.slice(eq + 1).trim()
|
|
49
|
+
// 去除首尾引号
|
|
50
|
+
if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) {
|
|
51
|
+
val = val.slice(1, -1)
|
|
52
|
+
}
|
|
53
|
+
result[key] = val
|
|
54
|
+
}
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 加载配置:默认值 ← .env.cb ← .env.cb.local ← process.env
|
|
59
|
+
const defaults = {
|
|
60
|
+
FINMALL_BASE_URL: 'https://uat-pkg.finmall.com',
|
|
61
|
+
FINMALL_APP_ID: '100042',
|
|
62
|
+
FINMALL_WORKSPACE_ID: 'dev',
|
|
63
|
+
FINMALL_CDP_PORT: '9222',
|
|
64
|
+
FINMALL_SYNC_CDP_PORT: '9333',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const envFile = parseEnvFile(path.join(PROJECT_ROOT, '.env.cb'))
|
|
68
|
+
const envLocal = parseEnvFile(path.join(PROJECT_ROOT, '.env.cb.local'))
|
|
69
|
+
|
|
70
|
+
const merged = { ...defaults, ...envFile, ...envLocal }
|
|
71
|
+
|
|
72
|
+
// process.env 优先级最高
|
|
73
|
+
for (const key of Object.keys(defaults)) {
|
|
74
|
+
if (process.env[key] !== undefined) merged[key] = process.env[key]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const baseUrl = merged.FINMALL_BASE_URL.replace(/\/+$/, '')
|
|
78
|
+
const appId = merged.FINMALL_APP_ID
|
|
79
|
+
const workspaceId = merged.FINMALL_WORKSPACE_ID
|
|
80
|
+
const cdpPort = Number(merged.FINMALL_CDP_PORT) || 9222
|
|
81
|
+
const syncCdpPort = Number(merged.FINMALL_SYNC_CDP_PORT) || 9333
|
|
82
|
+
|
|
83
|
+
export const finmallConfig = {
|
|
84
|
+
/** 服务域名(无尾斜杠) */
|
|
85
|
+
baseUrl,
|
|
86
|
+
/** 应用 ID */
|
|
87
|
+
appId,
|
|
88
|
+
/** 工作空间 ID */
|
|
89
|
+
workspaceId,
|
|
90
|
+
/** Chrome CDP 端口 */
|
|
91
|
+
cdpPort,
|
|
92
|
+
/** CDP 连接 URL */
|
|
93
|
+
get cdpUrl() { return `http://127.0.0.1:${cdpPort}` },
|
|
94
|
+
/** 后台无界面会话专用 CDP 端口(与手动导航器 cdpPort 隔离) */
|
|
95
|
+
syncCdpPort,
|
|
96
|
+
/** 后台会话 CDP 连接 URL */
|
|
97
|
+
get syncCdpUrl() { return `http://127.0.0.1:${syncCdpPort}` },
|
|
98
|
+
/** 卡片列表页完整 URL */
|
|
99
|
+
get targetUrl() {
|
|
100
|
+
return `${baseUrl}/innermanage/?platform=flame&appId=${appId}&workspaceId=${workspaceId}` +
|
|
101
|
+
'#/inner_flamePublish/card/list?currentPage=1'
|
|
102
|
+
},
|
|
103
|
+
/** 登录接口 URL */
|
|
104
|
+
get loginEndpoint() { return `${baseUrl}/ubomp-web/IM01001.do` },
|
|
105
|
+
/** 菜单接口 URL */
|
|
106
|
+
get menuEndpoint() { return `${baseUrl}/ubomp-web/IM01002.do` },
|
|
107
|
+
/**
|
|
108
|
+
* 图片上传接口 URL(编辑器「图片库」上传)。
|
|
109
|
+
* multipart/form-data,表单字段 `fileName`(原名)+ `file`(二进制);
|
|
110
|
+
* 查询串需带 sassAppId / sassWorkspaceId(由调用方按当前环境拼接)。
|
|
111
|
+
* 响应 body.uploadFileList[].filePath 即线上地址(形如 `@filestore/dzqd-download/<ts>_<name>.png`)。
|
|
112
|
+
*/
|
|
113
|
+
get uploadImgEndpoint() { return `${baseUrl}/ubomp-web/CC0000.do` },
|
|
114
|
+
/** 将 @filestore/ 或绝对路径转为完整 URL */
|
|
115
|
+
filestoreUrl(value) {
|
|
116
|
+
if (!value) return ''
|
|
117
|
+
if (value.startsWith('http://') || value.startsWith('https://')) return value
|
|
118
|
+
if (value.startsWith('@filestore/')) return `${baseUrl}/minio/${value.slice('@filestore/'.length)}`
|
|
119
|
+
if (value.startsWith('/')) return `${baseUrl}${value}`
|
|
120
|
+
return `${baseUrl}/${value}`
|
|
121
|
+
},
|
|
122
|
+
/** 项目根目录 */
|
|
123
|
+
projectRoot: PROJECT_ROOT,
|
|
124
|
+
}
|