feat(opencode-config): redact secrets and add MCP listing to the internal config API

This commit is contained in:
Chris Scott committed 2026-09-28 19:00:04 -04:00
1 parent 5bd688de4b
commit 4b294fbcef
31 files changed
+1238 -181

No files matched your search

+42
View File
@@ -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[] = [