精简:移除重复的插件更新器

This commit is contained in:
yexi committed 2026-11-03 16:35:58 +08:00
1 parent 35e3e7d9bc
commit 1b4d8b9205
18 files changed
+223 -1467

No files matched your search

-38
View File
@@ -14,8 +14,6 @@ async function fixture() {
status: [],
recheck: [],
preview: [],
'check-update': [],
'perform-update': [],
write: [],
}
function defer(endpoint, payload) {
@@ -139,39 +137,3 @@ test('开关提交立即使旧预览失效,配置事件刷新不能提前结
assert.equal(f.view().busy, false)
assert.equal(f.view().status.enabled, false)
})
test('版本检查与手动更新正确推进状态并透传目标版本', async () => {
const f = await fixture()
assert.equal(f.view().update.state, 'idle')
const checking = f.face.checkUpdate(true)
assert.equal(f.view().update.state, 'checking')
const checkReq = f.take('check-update')
assert.deepEqual(checkReq.payload, { force: true })
f.answer(checkReq, {
state: 'available',
currentVersion: '0.2.6',
latestVersion: '0.2.7',
latestTag: 'v0.2.7',
installSource: 'github',
})
await checking
assert.equal(f.view().update.state, 'available')
assert.equal(f.view().update.latestVersion, '0.2.7')
const installing = f.face.performUpdate()
assert.equal(f.view().update.state, 'updating')
const installReq = f.take('perform-update')
assert.deepEqual(installReq.payload, { targetTag: 'v0.2.7' })
f.answer(installReq, {
state: 'updated',
currentVersion: '0.2.6',
latestVersion: '0.2.7',
updatedVersion: '0.2.7',
restartRequired: true,
installSource: 'github',
})
await installing
assert.equal(f.view().update.state, 'updated')
assert.equal(f.view().update.restartRequired, true)
})
+2 -13
View File
@@ -11,8 +11,8 @@ import { fileURLToPath } from 'node:url'
import test from 'node:test'
import assert from 'node:assert/strict'
import {
ANCHORS, BLOCK_SECTION, EXECUTION_MODE_BLOCK, PRESETS, compareSemver, contractAdditions,
fuseSections, fusedMinimalPrompt, normalizeVersion, renderPreview,
ANCHORS, BLOCK_SECTION, EXECUTION_MODE_BLOCK, PRESETS, contractAdditions,
fuseSections, fusedMinimalPrompt, renderPreview,
} from '../src/rules.js'
const FIXTURES = fileURLToPath(new URL('./fixtures/', import.meta.url))
@@ -155,17 +155,6 @@ test('unknown presets are refused with unsupported-preset', () => {
assert.deepEqual(fuseSections([], 'my-custom-preset').issues, ['unsupported-preset'])
})
test('normalizeVersion and compareSemver compare release versions accurately', () => {
assert.equal(normalizeVersion('v0.2.6'), '0.2.6')
assert.equal(normalizeVersion(' 0.2.6-rc.1+build '), '0.2.6-rc.1')
assert.equal(normalizeVersion('invalid'), undefined)
assert.equal(compareSemver('0.2.6', '0.2.5'), 1)
assert.equal(compareSemver('0.2.6', '0.2.6'), 0)
assert.equal(compareSemver('0.2.5', '0.2.6'), -1)
assert.equal(compareSemver('0.2.6', '0.2.6-rc.1'), 1)
assert.equal(compareSemver('0.2.6-alpha.2', '0.2.6-alpha.1'), 1)
})
test('minimal fused prompt is persona + pointer + block, anchors intact, and preserves structured_output', () => {
const fused = fusedMinimalPrompt()
assert.ok(fused.startsWith(ANCHORS.personaMinimal))