mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat(opencode-config): redact secrets and add MCP listing to the internal config API
This commit is contained in:
1 parent
5bd688de4b
commit
4b294fbcef
31 files changed
+1238
-181
No files matched your search
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
MCP_OAUTH_CALLBACK_PATH,
|
||||
mcpOAuthRedirectUri,
|
||||
mcpServerViewsFromConfig,
|
||||
mcpServersFromConfig,
|
||||
mcpStatusByName,
|
||||
} from '@opencode-manager/shared/opencode'
|
||||
@@ -47,6 +48,47 @@ describe('mcpServersFromConfig', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('mcpServerViewsFromConfig', () => {
|
||||
it('normalizes native and legacy servers, reporting each shape and enabled state', () => {
|
||||
expect(
|
||||
mcpServerViewsFromConfig({
|
||||
timeout: { catalog: 5000 },
|
||||
legacy: { type: 'local', command: ['npx', 'legacy'], enabled: false },
|
||||
servers: {
|
||||
remote: { type: 'remote', url: 'https://native.example.com', disabled: true },
|
||||
local: { type: 'local', command: ['npx', 'native'] },
|
||||
},
|
||||
}),
|
||||
).toEqual([
|
||||
{
|
||||
name: 'legacy',
|
||||
type: 'local',
|
||||
command: ['npx', 'legacy'],
|
||||
enabled: false,
|
||||
shape: 'legacy',
|
||||
},
|
||||
{
|
||||
name: 'local',
|
||||
type: 'local',
|
||||
command: ['npx', 'native'],
|
||||
enabled: true,
|
||||
shape: 'servers',
|
||||
},
|
||||
{
|
||||
name: 'remote',
|
||||
type: 'remote',
|
||||
url: 'https://native.example.com',
|
||||
enabled: false,
|
||||
shape: 'servers',
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it('returns an empty list for a missing config', () => {
|
||||
expect(mcpServerViewsFromConfig(undefined)).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('mcpStatusByName', () => {
|
||||
it('maps every V2 status onto the Manager status map', () => {
|
||||
const servers: McpServer[] = [
|
||||
|
||||
Reference in new issue
Block a user