6f32a206b4
Keeps provider credentials local while executing OpenCode shell and file tools against the selected remote workspace over SSH.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
|
import {
|
|
openCodeBridgeToolNames,
|
|
renderOpenCodeBridgeConfigContent,
|
|
renderOpenCodeBridgeToolFile,
|
|
renderOpenCodeBridgeToolFiles,
|
|
} from '../packages/opencode-bridge/ts/index.js';
|
|
|
|
tap.test('should render managed OpenCode bridge config', async () => {
|
|
const config = JSON.parse(renderOpenCodeBridgeConfigContent());
|
|
|
|
expect(config.snapshot).toEqual(false);
|
|
expect(config.autoupdate).toEqual(false);
|
|
expect(config.permission.lsp).toEqual('deny');
|
|
expect(config.permission.skill).toEqual('deny');
|
|
});
|
|
|
|
tap.test('should render tool overrides for remote bridge', async () => {
|
|
const files = renderOpenCodeBridgeToolFiles();
|
|
|
|
for (const toolName of openCodeBridgeToolNames) {
|
|
expect(files[`tools/${toolName}.js`]).toInclude(`forwardTool(${JSON.stringify(toolName)}`);
|
|
}
|
|
expect(files['tools/bash.js']).toInclude('GITZONE_IDE_TOOL_BRIDGE_URL');
|
|
expect(files['tools/apply_patch.js']).toInclude('patchText');
|
|
});
|
|
|
|
tap.test('should allow custom bridge environment names', async () => {
|
|
const toolFile = renderOpenCodeBridgeToolFile('read', {
|
|
bridgeUrlEnvName: 'CUSTOM_BRIDGE_URL',
|
|
bridgeTokenEnvName: 'CUSTOM_BRIDGE_TOKEN',
|
|
});
|
|
|
|
expect(toolFile).toInclude('CUSTOM_BRIDGE_URL');
|
|
expect(toolFile).toInclude('CUSTOM_BRIDGE_TOKEN');
|
|
expect(toolFile).toInclude('filePath');
|
|
});
|
|
|
|
export default tap.start();
|