mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 03:27:00 +08:00
- 将用户可见品牌升级为 TraceMemo(迹忆) - 增加最早期 userData/sessionData 兼容路径选择 - 保留 WechatExplorer runtime identity 以兼容 safeStorage - 继续使用旧 Knowledge、Settings、API Token 和 Provider 配置 - 新日志写入 TraceMemo 目录并保留历史日志 - 保留旧 API、Skill、环境变量和导出目录兼容标识 - 更新相关文档、界面文案与自动化测试
70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
const assert = require('node:assert/strict')
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
const ts = require('typescript')
|
|
|
|
const filePath = path.join(
|
|
__dirname,
|
|
'..',
|
|
'src',
|
|
'renderer',
|
|
'src',
|
|
'features',
|
|
'api-center',
|
|
'utils',
|
|
'buildSkillInstallInstruction.ts'
|
|
)
|
|
const source = fs.readFileSync(filePath, 'utf8')
|
|
const output = ts.transpileModule(source, {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS }
|
|
}).outputText
|
|
const moduleExports = {}
|
|
new Function('exports', 'require', 'module', output)(moduleExports, require, {
|
|
exports: moduleExports
|
|
})
|
|
|
|
const { buildSkillInstallInstruction } = moduleExports
|
|
const local = {
|
|
type: 'local',
|
|
directoryPath: 'C:/skill/wechatexplorer-reader',
|
|
skillPath: 'C:/skill/wechatexplorer-reader/SKILL.md',
|
|
version: 'v1.0'
|
|
}
|
|
|
|
for (const [target, expected] of [
|
|
['codex', 'Codex 项目或用户 Skill 目录'],
|
|
['claude-code', '按照 SKILL\.md 调用本地 HTTP API'],
|
|
['openclaw', '作为 TraceMemo Reader Skill 安装'],
|
|
['generic', '读取并安装']
|
|
]) {
|
|
const text = buildSkillInstallInstruction({
|
|
target,
|
|
source: local,
|
|
apiBaseUrl: { host: '127.0.0.1', port: 6131 }
|
|
})
|
|
assert.match(text, new RegExp(expected))
|
|
assert.match(text, /http:\/\/127\.0\.0\.1:6131\/api\/v1\/health/)
|
|
assert.match(text, /WECHATEXPLORER_API_TOKEN/)
|
|
assert.match(text, /Authorization: Bearer/)
|
|
assert.doesNotMatch(text, /mcpServers/)
|
|
}
|
|
|
|
assert.match(
|
|
buildSkillInstallInstruction({
|
|
target: 'codex',
|
|
source: local,
|
|
apiBaseUrl: { host: '0.0.0.0', port: 7000 }
|
|
}),
|
|
/http:\/\/127\.0\.0\.1:7000\/api\/v1\/health/
|
|
)
|
|
assert.match(
|
|
buildSkillInstallInstruction({
|
|
target: 'generic',
|
|
source: { type: 'remote', installUrl: 'https://example.com/skill', version: 'v1.0' },
|
|
apiBaseUrl: { host: 'localhost', port: 6131 }
|
|
}),
|
|
/https:\/\/example\.com\/skill/
|
|
)
|
|
|
|
console.log('skill install instruction tests passed')
|