mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
feat: 注册内建 weixin channel 插件
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
17
src/services/mcp/__tests__/channelAllowlist.test.ts
Normal file
17
src/services/mcp/__tests__/channelAllowlist.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, mock, test } from 'bun:test'
|
||||
|
||||
mock.module('../../analytics/growthbook.js', () => ({
|
||||
getFeatureValue_CACHED_MAY_BE_STALE: () => [],
|
||||
}))
|
||||
|
||||
import { isChannelAllowlisted } from '../channelAllowlist.js'
|
||||
|
||||
describe('isChannelAllowlisted', () => {
|
||||
test('allows builtin weixin plugin', () => {
|
||||
expect(isChannelAllowlisted('weixin@builtin')).toBe(true)
|
||||
})
|
||||
|
||||
test('rejects undefined plugin source', () => {
|
||||
expect(isChannelAllowlisted(undefined)).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { z } from 'zod/v4'
|
||||
import { BUILTIN_MARKETPLACE_NAME } from '../../plugins/builtinPlugins.js'
|
||||
import { lazySchema } from '../../utils/lazySchema.js'
|
||||
import { parsePluginIdentifier } from '../../utils/plugins/pluginIdentifier.js'
|
||||
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../analytics/growthbook.js'
|
||||
@@ -68,6 +69,9 @@ export function isChannelAllowlisted(
|
||||
if (!pluginSource) return false
|
||||
const { name, marketplace } = parsePluginIdentifier(pluginSource)
|
||||
if (!marketplace) return false
|
||||
if (marketplace === BUILTIN_MARKETPLACE_NAME && name === 'weixin') {
|
||||
return true
|
||||
}
|
||||
return getChannelAllowlist().some(
|
||||
e => e.plugin === name && e.marketplace === marketplace,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user